How to balance clean code with deadlines in a real team
technical debt management, good enough vs perfect, incremental improvement, boy scout rule in practice, clean code ROI argument
Clean Code and Deadlines: The Practical Balance
Clean code isn't about perfection. It's about the minimum level of quality that makes code maintainable. Deadlines are real, and clean code absolutism destroys teams and ships nothing.
The practical framework:
Prototype code — quick experiments, throw-away proofs of concept. Skip clean code here. But throw it away. The problem is when prototypes become production code.
Production code — must meet a minimum standard: intention-revealing names, functions under 20 lines, no magic values. These are fast to do and save hours of debugging later. No excuses.
Under deadline: apply the boy scout rule. Don't block yourself on making everything perfect. Make the thing you're touching better than you found it. Rename one variable. Extract one function. Write one test for the path you changed. Compound this over six months and the codebase transforms.
// Under deadline — you touch this function
// Don't ignore the bad name you see
// Spend 30 seconds:
// OLD: function proc(d) { ... }
// NEW: function processExpiredSubscriptions(subscriptions) { ... }
// Done. Move on.When arguing for refactoring time with a manager, use concrete numbers. "The payment service has 12 functions over 50 lines and took us 3 hours to debug last sprint. Two hours of refactoring would cut debug time in half." Abstract arguments about code quality lose. Concrete time-and-money arguments win.
