The SOLID Foundation¶
Modern class design is governed by the SOLID acronym, which provides a roadmap for preparing for change:
- S - Single Responsibility: One class, one reason to change.
- O - Open/Closed: Extend behavior without modifying source code.
- L - Liskov Substitution: Derived classes must be perfectly swappable for their base classes.
- I - Interface Segregation: Don't force a class to implement methods it doesn't use.
- D - Dependency Inversion: Depend on abstractions (interfaces), not concrete implementations.