teacher
Sign in

SOLID Principles

Five guidelines for classes that stay easy to change, each with the smell that tells you it is being broken.

35 min3 interactive

Why principles at all

Code is read and changed far more often than it is written. SOLID is a set of five guidelines, named by Robert C. Martin, that aim at one thing: a new requirement should cost a small, local change.

LetterPrincipleOne-line meaning
SSingle ResponsibilityA class has one reason to change
OOpen/ClosedOpen to extension, closed to modification
LLiskov SubstitutionA child can stand in for its parent without surprises
IInterface SegregationMany small interfaces beat one fat one
DDependency InversionDepend on abstractions, not concrete classes
1 of 9