Last updated: Apr 29, 2026
SOLID Principles
Five principles for designing classes and their relationships. They come up constantly in low-level design problems because most of them involve designing class hierarchies.
You don’t need to name them constantly. Apply the lessons and reference them briefly when explaining a decision.
| Principle | One line |
|---|---|
| SRP — Single Responsibility | A class should have one reason to change |
| OCP — Open-Closed | Open for extension, closed for modification |
| LSP — Liskov Substitution | Subclasses must work wherever the base class works |
| ISP — Interface Segregation | Keep interfaces small and focused |
| DIP — Dependency Inversion | Depend on abstractions, not concrete implementations |
One caveat: SOLID comes from the Java era of deep class hierarchies. In modern codebases, not every principle applies everywhere. Apply them when the problem calls for it — don’t add complexity just to check a box.