Chapter 6 of 10All chapters
Chapter 6 of 10
Design principles
SOLID, briefly and honestly.
The five
One reason to change per class. Open to extension, closed to modification. Subclasses substitutable for parents. Small interfaces over large ones. Depend on abstractions, not concrete types.
- They are heuristics for managing change, not laws.
- Applying all five to a small program produces more indirection than value.
The one that pays
Single responsibility earns its keep everywhere. If you can name two unrelated reasons a class would change, splitting it usually pays for itself within a month.