4 ms·
I'm not sure I agree on this. OOP is really about implementation inheritance and ad-hoc polymorphism based on the same, and it's pretty clear by now that these
by zozbot234 7y ago
I'm not sure I agree on this. OOP is really about implementation inheritance and ad-hoc polymorphism based on the same, and it's pretty clear by now that these are not good ideas because of e.g. the fragile-base-class problem, that basically involves violations of modularity.
Simpler object-based paradigms and languages, which feature "classes" and "objects" for encapsulation and data abstraction, plus maybe some interface-only subtyping, are used all the time and work quite well with functional programming concepts.
- acdha 7y agoThe main lesson I’ve drawn is that the real problem is dogma: OOP works fine if you aren’t trying to follow some One True Way™ rather than adjusting based on your needs, problem domain, and resources. The same is true of most other styles: FP is prone to getting a certain brand of immutability fanatic who will cause problems until they learn more about computer architecture and get a more nuanced position. In every case, focusing on dogma avoidance and having reasonable technical debt levels seems to be far more important than the specific language and paradigm.
- smabie 7y agoPeople think that with FP you end up just copying a bunch of stuff constantly. But in my experience, that's rarely true: structural sharing minimizes copying so that the performance is usually on par with in place mutation. In fact, in some situations, the immutability guarantees make the program faster than the mutable version. Moreover, advanced compilers (like GHC and the OCaml compiler), can often turn functional code that allocates and copies into in-place, GC-free code.
- acdha 7y agoRemember, I was talking about dogmatic silliness - the kind of thing where someone thinks it’s some kind of moral failing to use Haskell’s mutable structures, even though they’re there for a reason. My point was that this seems like the same mindset even in two fairly different domains, and that we’re prone to talking about it as a technical problem when it’s really more of social one.