Video in progress
How do you justify time for refactoring and clean-code work to business leadership?
Not with "the code is ugly", but with numbers: feature delivery time, the number of incidents in that module, onboarding time. I propose refactoring not as a separate project but as an investment tied to an upcoming business task.
📖 Answer
Leadership doesn't react to the phrase "technical debt", it reacts to the consequences. And the consequences can be measured:
- Lead time: the average task in the
billingmodule takes 9 days, in other modules 3 days. - Change failures: 30% of releases in that module needed a hotfix (DORA's change failure rate metric).
- Incidents: 5 P1s in the last quarter, all around one class.
- Hotspot analysis: the intersection of the most-changed and the most complex files in git history. Usually 5% of the codebase takes half the changes, and that's where the investment goes.
The shape of the proposal:
"Next quarter we need to add a new provider to payments. With the current structure that's ~6 weeks. If we first spend 2 weeks separating
PaymentProcessor, the provider takes 2 weeks, and the next ones get faster too."
What works in practice:
- The boy-scout rule: leave the code you touch a bit better. It needs no separate permission.
- A permanent share of the sprint (for example, 15–20%) so you don't have to negotiate every time.
- Big refactorings come with an ADR: the problem, the options, the expected result, how we'll measure it.
- Show the result: how lead time and incidents changed after the refactoring. That builds trust for next time.
You also have to be honest: not every debt has to be paid. An old module that rarely changes and works fine can be "ugly but cheap". Leaving it alone is also a right decision.
Sign up to mark studied questions and save your progress.