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
You call it scattering, I call it incrementality. It can really compress the conceptual space and make for simpler and more robust code. Good tooling will help you find the superclasses and collate their documentation.
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!