3 ms·
> My point is that high-quality OOP code typically adheres to the rules of Monads. Last I checked, there are only three laws: left/right identity and associati
by catnaroek 10y ago
> My point is that high-quality OOP code typically adheres to the rules of Monads.
Last I checked, there are only three laws: left/right identity and associativity, and they are just algebraic laws that have nothing to do with your code being “good” or “bad”. Or do you have some other meaning of “rules of monads” in mind?
Furthermore, every higher-order strict language is already monadic, without you having to do anything special. Thus, monads aren't opt-in, or even opt-out; they're there whether you like it or not. This monadic structure permeates the language, regardless of whether you write “good” or “bad” programs in it. For more info, see here: https://news.ycombinator.com/item?id=13823145 https://news.ycombinator.com/item?id=13823145
- smaddox 10y agoYes, those are the laws. The theorems are more interesting from a maintaining-software perspective, though. Yes, all higher-order strict languages can be embedded in a monadic model. However, there's an important practical difference between a single Monad with the entire application or computer's state encapsulated (course grain encapsulation), and many Monads with fine-grained encapsulation. High-quality OOP code can be embedded in the latter, and that's where the maintainability comes from. --- Perhaps, if you focused more on understanding the point I'm trying to make instead of proving me wrong, this conversation would be more beneficial to both of us.