Re:Inheritance versus Composition
by diminoten on Wednesday May 08, 2019 @09:45PM
(#19864635)
This very article ends with '"¿Por qué no los dos?", which means "Why not both?"'. I agree, use both, but don't get carried away with either. If you exclusively use composition you're basically reinventing inheritance anyway, with more steps.
These are the articles where someone saw that the "cool kids" don't like/use inheritance, and so adopted the position to try and be "cool".
Don't try to be cool, try to understand. Inheritance doesn't say, "Create a complex inheritance tree of interdependent classes". That's the strawman. Remember that.
But the linked article is reasonable. Less reasonable articles like this one exist, however: https://codeburst.io/inheritance-is-evil-stop-using-it-6c4f1...
These are the articles where someone saw that the "cool kids" don't like/use inheritance, and so adopted the position to try and be "cool".
Don't try to be cool, try to understand. Inheritance doesn't say, "Create a complex inheritance tree of interdependent classes". That's the strawman. Remember that.