Stable Dependencies Principle
- Definition
- A module should only depend upon modules that are more stable than it is.
How does it work?
The instability of a module is defined as the ratio between the number if incoming dependencies and the number of combined incoming/outgoing dependencies.
Instability = # incoming dependencies / (# incoming dependencies + # outgoing dependencies)
An stable module is harder to change than an instable module, because it has more modules that need to be checked and changed.
An instable module needs to change more often than an stable module, because it has more modules that it depends on.
If you build a dependency hierarchy that keeps the most stable modules on the top, and the most instable modules on the bottom, the system will be easier to change and maintain.