What are the tradeoffs of using deep Inheritance hierarchies?
Last updated
Benefit: shared code lives in one place, and subtypes work polymorphically through a common base type.
Costs: the fragile base class problem (changes high up silently break distant subclasses) and the "yo-yo problem" of tracing behavior across many ancestors.
Guidance: keep hierarchies shallow and favor composition. Reserve inheritance for genuine "is-a" relationships with a stable base.
- https://dev.to/illia_wolkow_61d1e8e752c0/why-composition-is-better-than-inheritance-in-oop-a-practical-guide-to-cleaner-code-5dcl
- https://medium.com/c-sharp-programming/everything-you-need-to-know-about-inheritance-in-programming-0-to-113c62b6f961
- https://blog.stackademic.com/essential-software-design-principles-favor-composition-over-inheritance-b7008de05338
- https://learn.microsoft.com/en-us/answers/questions/1338985/partial-class-support-vs-specify-a-base-class
- https://algocademy.com/blog/understanding-inheritance-in-object-oriented-programming-a-comprehensive-guide/
- https://learn.microsoft.com/en-us/windows/apps/develop/platform/xaml/xaml-syntax-guide
- https://www.techinterview.net/questions/object-oriented-programming-interview-questions
- https://www.nostrobeai.com/interview-questions/oops