Searching for a concrete method implementation? Go back and forth, up and down.
- Deep Hierarchies
- Subclassification for Code Reuse
- Low Cohesion
- High Coupling
- Favor composition over inheritance.
- Refactor deep hierarchies.
Any linter can check for suspects against a max depth threshold.
Many novice programmers reuse code through hierarchies. This brings high coupled and low cohesive hierarchies.
Johnson and Foote established in their paper this was actually a good design recipe back in 1988. We have learned a lot from there.
We must refactor and flatten those classes.
Code Smell 11 — Subclassification for Code Reuse
Code reuse is good. But subclassing generates a static coupling.
Coupling: The one and only software design problem
A root cause analysis of all failures of our software will find a single culprit with multiple costumes.
In software development, the yo-yo problem is an anti-pattern that occurs when a programmer has to read and understand…
An error arises from treating object variables (instance variables) as if they were data attributes and then creating your hierarchy based on shared attributes. Always create hierarchies based on shared behaviors, side.
This article is part of the CodeSmell Series.