One of the most self-aware learnings to come out of OOP is "favor composition over inheritance". Even in OOP, inheritance is an anti-pattern. All roads lead to FP.
-
-
Replying to @jdegoes
I call bullshit on that. I use trait inheritance all the time for my (type)classes. Enriching data structures by adding new operations out refining existing ones, adding or refining cases, fields, etc., is a great way to incrementally define libraries.
3 replies 0 retweets 6 likes -
Replying to @Ngnghm
It's pretty widely accepted in OOP that implementation inheritance should not be favored if composition is feasible. Implementation inheritance leads to scattering out domain logic over a hierarchy, bugs due to violations of implicit contracts, and other issues.
3 replies 0 retweets 1 like -
Replying to @jdegoes
This is lore from bad languages that are so lacking that developers abuse some language features as poor substitute to achieving other features. As in, using products and nulls to emulate sums. But it also applies in reverse, with FP abused to mimic OOP when unavailable.
1 reply 0 retweets 1 like -
Replying to @Ngnghm
It's not lore, it's most definitely a fact I can attest to (tho' agreed on bad languages). Overriding by definition scatters domain logic over the inheritance hierarchy, and anything overridden is behaving differently in a subtype by definition, which causes its own bugs.
2 replies 0 retweets 0 likes -
Replying to @jdegoes
Inheritance without laws sucks no less than typeclasses without laws or parameters without laws. The problem is lack of laws. Document your laws in the trait that introduces the methods. Override the algorithm for a speedup but don't contradict the laws — or use distinct names.
1 reply 0 retweets 1 like
If many inheritance hierarchies are chaos, it's because it reflects the chaos in the minds of the programmers and/or in their institutional organizations. Ad hoc and parametric polymorphism are dual ways to bring order. Neglecting either yields chaos.
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.
Read my blog!