Last Revision — April 19, 2022
1 Min Read
Base Classes Depending on Their Derivatives
Object Oriented Abusers
Interfaces
Between Classes
- Shotgun Surgery (causes)
Robert C. Martin in book (2008): "Clean Code: A Handbook of Agile Software Craftsmanship"
The rule is that the child classes should be deployable independently from the parent class. That allows us to deploy the system in discrete and independent components.
When one of these subclasses is modified, the base class does not need to be redeployed as well. In this way, the impact of change is much smaller, proportionally to the maintenance effort [1]. This smell is closely related to the Shotgun Surgery code smell.
Base class and Subclass should be interchangeable without breaking the logic of the program.