In 30 seconds
- Clean code is readable, simple and well tested.
- Clear names, small functions, no duplication.
- It keeps change cheap, which keeps teams fast.
Core habits
- Clear names: say what things are and do
- Small functions: each does one thing
- No duplication: one place for each rule
- Tests: so changes are safe
- Comments for why, not what
Robert C. Martin's 2008 book Clean Code popularized the term.
Why it matters
Code is read far more often than written. Messy code adds technical debt that slows every future change; clean code keeps the team's pace sustainable.
Building the habit
- Use code reviews to spot unclear code
- Refactor a little every time you touch code
- Agree team style rules and automate them with linters
Myth vs reality
Myth · Clean code means clever code.
Reality · Simple, obvious code is cleaner than clever code.
Myth · It slows delivery.
Reality · It speeds up every later change.
Myth · Clean code is a matter of taste.
Reality · Many principles, like naming and duplication, are widely agreed.
The AI angle
AI-generated code can look clean while drifting from team conventions or duplicating logic. Give AI tools your standards and review against them.
FAQ
Is there one right style?
No; consistency within a team matters most.
Should we stop to clean old code?
Clean what you touch rather than scheduling big clean-ups.
How do linters help?
They catch style issues automatically so reviews focus on design.