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.

PrincipleOne line
SRP — Single ResponsibilityA class should have one reason to change
OCP — Open-ClosedOpen for extension, closed for modification
LSP — Liskov SubstitutionSubclasses must work wherever the base class works
ISP — Interface SegregationKeep interfaces small and focused
DIP — Dependency InversionDepend 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.