I don't think OOP is hard to get right if you only use it for the problems that are shaped like OOP.
Peter Aaser
@PeterAaser
true
Ichoran
@Ichoran
I guess it doesn't help that OOP's sweet spot is really small compared to what it was billed as (solution to everything)
Rob Norris
@tpolecat
Agree, as long as we can disagree about how big the spot it.
Ichoran
@Ichoran
I suspect you think that the spot is the empty set, or perhaps the definition of OOP data structures. ("OOP data structures are a great way to model OOP data structures!")
Peter Aaser
@PeterAaser
I think we can all agree on disagreeing
Ichoran
@Ichoran
Anyway, I find OOP great for trees of ever-increasing but not-substantially-changing functionality, and/or elaboration of a basic operation with specialization on different types of data.
I find it lousy for plugging in new functionality, not earlier conceived, to relevant parts of an existing design.
Rewiring an entire inter-method dependency graph in a subclass is entirely possible, and terrifying. I can't even get that right the first time I write it, much less when maintaining it.
Marcin Sokrates
@marcinsokrates_twitter
I can't get over how akka-http is so extensible... they had to write a whole separate event loop for unix sockets to support them
Josh
@joshlemer
I find it confusing when doing things like, subclass calls super.foo() which calls this.bar() which is itself overridden in the subclass, that gets confusing
Ichoran
@Ichoran
Yeah, but that's how it's supposed to work. As long as you don't rewire your dependency graph, it's cool.
Basically you need strict LSP but also every dependency of method a on b has to be treated as part of the interface. Then things might "get confusing", but they generally work.
The whole point is that in the superclass, whether it's calling its own bar or the subclass bar is irrelevant insofar as the superclass can observe.
It is, admittedly, a little too easy to muck it up and make it matter.
But hey, it's easy to muck up recursion and make it infinite, and we still use recursion :)
What is confusing is when foo depends on bar in the superclass, but in the subclass bar depends on foo. Then in a subsubclass, who do you override to get the right behavior?
Peter Aaser
@PeterAaser
fuck if I know, I havent even called .super in 5 years or so
Ichoran
@Ichoran
That kind of problem--unlike the "make it superclass-unobservable whether superclass bar or subclass bar is called" problem--can't be solved locally, so it can grow arbitrarily difficult.
Rob Norris
@tpolecat
Subtyping is hard.
Ichoran
@Ichoran
Lots of things are hard.
Some hard things aren't worth mastering if they don't give you enough benefit, though.
Rob Norris
@tpolecat
I think Java-style OOP as it's practiced doesn't pay for itself in terms of the complexity it introduces. Limited use of subtyping in Scala may end up being ok. My personal jury is out.