Clean Code
Code other people can read and change.
Writing code that other people (and your future self) can read, trust and change: why readability pays, naming, functions and comments, formatting and style, simplicity, duplication and the wrong abstraction, complexity, cohesion and coupling, SOLID and its critics, composition, boundaries and dependencies, error handling, null and absence, types as documentation, code smells, refactoring, technical debt, static analysis, reviewing AI-written code, and team conventions. Language-neutral, with examples in JavaScript, Python, Java and Go, and a fair hearing for competing schools of thought rather than one book's rules. By the end you can spot what makes code hard to change and improve it in small, safe steps.
- 7
- chapters
- 22
- modules
- ~8h
- of learning
- 22
- live now
Take modules in any order. The route suggests one that builds up naturally.
has a live module in progress complete
Take a look inside
The big picture, before the details
What makes code easy to read and change: readable foundations, simplicity, design, errors and edges, changing code safely, and team habits. Watch the tour, or click any part.
Readable foundations: names that explain, functions that do one job, comments that say why (modules 1–4).
A taste of module 8: flatten a nested function in three behaviour-preserving steps and watch its complexity fall.
function canRefund(order, user) { if (order) { if (order.status === "PAID") { if (user.isAdmin || user.id === order.customerId) { if (daysSince(order.paidAt) <= 7) {return true;
} else {return false;
}
} else {return false;
}
} else {return false;
}
} else {return false;
}
}
Same behaviour at every step.
Foundations
Readable code, from names to functions.
4 modules · 85 min
Shape and simplicity
Consistent shape, and as little as possible.
4 modules · 90 min
Beginner
Formatting and style
Let the machine argue about spaces.
Core
Keep it simple
KISS and YAGNI.
Core
Duplication and the wrong abstraction
DRY, with care.
Core
Complexity
Nesting, branches and how much fits in your head.
Design
How pieces fit together.
4 modules · 95 min
Core
Cohesion and coupling
Things that change together, live together.
Deep dive
SOLID, with its critics
Five principles, used with judgement.
Core
Composition over inheritance
Build from parts, not family trees.
Deep dive
Boundaries and dependencies
Keep the core free of the details.
Errors and edges
Making failure and absence explicit.
3 modules · 70 min
Changing code
Smells, refactoring and debt.
3 modules · 65 min
Tools and teams
Keeping a whole codebase clean.
3 modules · 60 min
Capstone
Put it all together.
1 module · 35 min