Apr 6, 2022
Inheritance is just a tool it has its uses. The reason the phrase to prefer composition gained popularity is because inheritance is taught early in OO classes and far to many devs latched into it as the every-tool. When in fact as you point out it should be one of the last tools you reach for. Personally I prefer to use Interface inheritance with functional composition.