Inheritance reduces duplication in code. In fact the original "wrong" approach can be written with less code and allows for polymorphism which is a core tenant of OOP. E.g. in Java Shape is a base interface for many shape objects.
The problem with IS A relates to overuse and detachment from semantics. Using it instead of composition etc. But having a common based class or hierarchy, that's good.
Learn something new every day.
- I am a senior software engineer working in industry, teaching and writing on software design, SOLID principles, DDD and TDD.
Location
Buenos Aires
Education
Computer Science Degree at Universidad de Buenos Aires
Inheritance reduces duplication in code. In fact the original "wrong" approach can be written with less code and allows for polymorphism which is a core tenant of OOP. E.g. in Java Shape is a base interface for many shape objects.
The problem with
IS A
relates to overuse and detachment from semantics. Using it instead of composition etc. But having a common based class or hierarchy, that's good.Yes!
That is exactly why this is just a "smell" and not a directive.
I agree with you overuse and detachment from semantics are the symptoms