What does "clean code" actually mean, and can you overdo it?
"Clean code" usually means code that is easy for another person to read, understand and change safely. Common traits:
- Clear, descriptive names for variables and functions
- Functions that do one thing at a consistent level of abstraction
- Little duplication of important logic
- Obvious control flow without deep nesting
- Tests that make changes safe
But clean code advice can be overapplied. Common ways it goes wrong:
- Too many tiny functions, so reading one behavior means jumping across ten files
- Premature abstraction: interfaces and factories for things with only one implementation
- Dogmatic DRY: merging two pieces of code that look alike but change for different reasons, creating awkward coupling
- Pattern-heavy design where the patterns themselves become the complexity
A helpful counterweight is the idea that duplication is cheaper than the wrong abstraction. Waiting until you see a pattern three times before extracting it is a popular heuristic.
Ultimately "clean" is judged by the next person who has to modify the code, often you in six months.
Which clean code rules do you follow strictly, and which do you ignore? Have you worked in a codebase that was too abstract to be readable?
Comments · 2
From a business side, 'clean' is whatever keeps change cheap. Over-engineering for flexibility you never use is its own cost.
Naming is the part that translates across fields. A clear name beats a comment in nearly every case, and that's true in design systems too.