2 ms·
Agreed, it’s a really concise and clear articulation of one of the main traps of inheritance thinking. I also think people are very receptive to this once you
by mlthoughts2018 7y ago
Agreed, it’s a really concise and clear articulation of one of the main traps of inheritance thinking.
I also think people are very receptive to this once you point it out. You’re not trying to make a class hierarchy because you come to the problem with a presupposed mental model. Instead you should be letting your attempt to solve the problem with no abstraction teach you about the places where abstraction would help. Maybe it should be organized as inheriting behaviors via mixins instead of specializing behaviors based on a hierarchical relationship with a parent type. Or maybe all the classes just need to be simple record / tuple wrappers and the methods that operate on them don’t belong to any class at all.
The reason examples like car extends vehicle cause harm is that they can be superficially taken as an endorsement that you should bring preconceived mental models of relationships between components into the solution, before trying to solve it with zero abstraction and observing where this breaks down.