Track 04 · Lesson 1 of 15Code that stays easy to change
- 01Principles at a glance
- 02SOLID principles at a glance
- 03S: Single responsibility
- 04O: Open/closed
- 05L: Liskov substitution
- 06I: Interface segregation
- 07D: Dependency inversion
- 08Separation of concerns
- 09DRY: Don't repeat yourself
- 10KISS: Keep it simple
- 11YAGNI: You aren't gonna need it
- 12Composition over configuration
- 13Fail fast
- 14Least surprise
- 15When they disagree
Track 04 · Code that stays easy to change
Principles at a glance
Lesson 1 of 15· 6 min
SOLID, DRY, KISS, YAGNI and four everyday habits: twelve principles experienced engineers lean on, on one page. Each is a short answer to the same question: why was this change harder than it should have been? Get the whole map here, then the lessons after this one take them one at a time, each with a switch that shows the code without the principle, then with it.
The principle map
Tap each card: the idea, the smell, the question to ask
Tap a card to see what it means, the smell it fixes and the question to ask in review.
0 of 12 explored
SOLID · Five rules for code that changes safely
The lean three · Less code, fewer places to change
Everyday habits · Small choices that save hours
Pick any card. There’s no order here; the lessons after this one go through them one by one.
Notice how many smells sound familiar. Each one is a different kind of “this change was harder than it should have been”.
SOLID: five rules for code that changes safely#
Single responsibility: one reason to change per module. Open/closed: add behavior by adding code, not by editing code that works. Liskov substitution: a subtype must work anywhere its parent does. Interface segregation: don’t make anyone depend on methods they don’t use. Dependency inversion: depend on an interface and plug the real thing in from outside. They come first in this track, with their own overview in SOLID principles at a glance.
DRY, KISS and YAGNI: the lean three#
DRY (don’t repeat yourself): every rule has one home, so a change happens in one place. KISS (keep it simple): the fewest moving parts that do the job. YAGNI (you aren’t gonna need it): build for today, not for a future someone imagined. All three are about less code: fewer copies, fewer layers, fewer options.
Four everyday habits#
Separation of concerns: keep data, rules and presentation apart, so each can change and be tested alone. Composition over configuration: build from small parts instead of adding a prop for every case. Fail fast: check data where it enters and complain loudly. Least surprise: code does what its name says and nothing more.
Questions, not laws#
These principles overlap and sometimes pull against each other: removing duplication (DRY) can add an abstraction that isn’t simple (KISS). Use them as questions in code review, not rules to win arguments with. The last lesson of this track, When they disagree, walks through the common clashes.
Name that smell
Twelve symptoms from real code. Which principle prevents each?
You changed the free-shipping threshold in checkout, but the cart banner still shows the old number.
Which principle would have prevented this?
Check yourself