SOLID in One Pass
Low-Level Design: lesson 5 of 10
Five habits that stop tomorrow's change from touching twenty files.
Lesson 5 of 10 · 5 min
SOLID in One Pass
Step 1 of 12
Five habits, one goal: make tomorrow's change touch one file instead of twenty.
The Idea
Five habits, one goal: keep a change local. S — one reason to change per class. O — extend by adding code, not editing it. L — a subtype must be usable wherever its parent is. I — several small interfaces beat one fat one. D — depend on abstractions, not concrete classes.
Real-World Example
A jacket altered for a new wearer. The sleeves shorten without touching the canvas, and a worn lining is replaced without recutting the shell, because the maker kept those layers independent from the first cut.
The Tradeoff
Applied early and everywhere, SOLID buries three lines of logic under four files and two interfaces. Each letter buys flexibility along one axis; pay only where you have evidence that axis actually moves. Duplication is cheaper than the wrong abstraction.
Your turn
Put the steps in the right order.
- Put the varying part behind an interface the caller depends on
- Notice that one class keeps changing for two unrelated reasons
- Add the next behaviour as a new implementation, editing nothing
- Split it so each half has a single reason to change
Mini quiz
1 / 3