A ticket labeled Refactor module being pushed from sprint to sprint while features ship, growing larger with each deferral until it becomes a project too large for any sprint.
Engineering Practices, Code Quality, Engineering Leadership

The Refactoring That Never Made It Into the Sprint

By Shivani Sutreja5 min read

Refactoring never wins a sprint against delivery pressure — not because engineers lack discipline, but because the system makes the wrong outcome inevitable. The cost of refactoring is immediate; the benefit is deferred. Until refactoring is made structural — budgeted, gated, and prioritised by data — it will keep losing to whatever ships this week.

Someone wrote "we should refactor this" in a PR comment nine months ago. Three more features have been built on top of it since. The comment is still there. The code is still there.

Nobody forgot. It just never won a sprint.

The Mechanism of Deferral

Refactoring work follows a predictable path before it disappears.

It gets identified. A PR comment catches the problem. A tech debt ticket gets opened. A retro action item captures the intention. Someone saw the problem and named it — that part works.

Then comes prioritisation. And here it ends.

Against a customer feature, refactoring has no immediate value. Against a bug fix, it has no urgency. Against a deadline, it has no advocate. It gets pushed to next sprint. Next sprint becomes next quarter. Next quarter becomes "when things slow down."

Things do not slow down.

The ticket stays open. The comment stays unresolved. The code stays as it was — except now new code is written around it.

What Accumulates While It Waits

A refactoring that was two days of work becomes four. Then eight. Then a task requiring its own planning meeting.

The engineer who understood the problem knows the context: what constraint forced the shortcut, what the better shape would look like. Six months later, they have moved teams. The context leaves with them.

Meanwhile the code does not stay still. A new module depends on the function that was supposed to be rewritten. An abstraction everyone else writes against emerges from the thing that was supposed to be temporary. The code gains weight — not through intention, but through accretion.

This is not technical debt accumulating slowly. It is technical debt compounding. Each sprint it waits, the scope grows, the dependencies deepen, and the risk of touching it increases.

The Refactoring That Became the Architecture

Here is where it gets permanent.

Most deferred refactoring remains deferrable — a class that could be simpler, a function that does too much. Uncomfortable, but containable.

Some of it does not stay containable. Some of it gets built on.

The service that was supposed to be temporary becomes the integration point for four others. The database schema that was supposed to be migrated acquires five more columns and three foreign keys. The abstraction everyone was going to replace becomes the model every other module is written against.

At that point, refactoring is no longer a cleanup task. It is a project — with a planning phase, a migration path, a risk assessment, and a timeline that no one will approve for cleanup work.

The PR comment from nine months ago is no longer a reminder. It is a record of the moment the decision stopped being available.

Why Willpower Always Loses

The argument for refactoring is always the same: clean this up now and we will move faster later. The argument is correct. It also loses every time.

The reason is structural. Delivery pressure is immediate and visible. The sprint is two weeks. The feature ships this sprint or it does not ship. The benefit of refactoring is deferred — next quarter, maybe six months from now. The cost is right now: capacity pulled from delivery.

Individual engineers understand the trade-off. Teams understand it. They choose delivery anyway, because the incentive structure gives them no other option. The team that skips refactoring ships the feature. The team that does refactoring ships it later, and gets asked why they are slower.

Willpower against incentive structures loses. Every time. In every organisation. This is not a discipline problem — it is a system that produces the wrong outcome reliably.

What Making It Structural Looks Like

The teams that refactor continuously have not found better discipline. They have made refactoring structural.

Protected capacity: 15 to 20 percent of sprint capacity, non-negotiable, not reallocated when a feature is late. Not a dedicated refactoring sprint — those get cancelled when delivery pressure mounts, which is always. A line item in every sprint, week after week.

Quality gates that fail when complexity crosses a threshold. Refactoring is not optional when the gate requires it — it becomes a prerequisite for the next commit, not a separate conversation.

Prioritisation by data, not by whoever argues loudest. Code health metrics identify which files have the highest coupling, the highest churn, the lowest coverage on changed lines. The refactoring order follows impact. The political conversation becomes a data question.

When refactoring is budgeted, gated, and prioritised by measurement, it stops competing with delivery pressure. It becomes part of delivery.

The Bottom Line

The PR comment from nine months ago is not a reminder to act. It is a record of a structural failure — the system had no mechanism to protect refactoring from delivery pressure, so delivery pressure won, as it always will when left to compete on willpower.

Track the age of your oldest open refactoring work. If it is more than two sprints old, willpower is not the answer. You need a system that makes refactoring as non-negotiable as shipping.

The alternative is discovering, one sprint too late, that the thing you were going to clean up has become the thing the architecture depends on. By then, it is not a sprint task. It is a project. And projects for cleanup do not get approved.

Frequently Asked Questions

Why does refactoring never make it into the sprint?

Refactoring loses to delivery pressure because the trade-off is structurally unfair. The cost of refactoring is immediate — capacity pulled from the sprint. The benefit is deferred — faster delivery next quarter. In a system where teams are judged on what ships this sprint, refactoring will always lose unless it is made structural through protected capacity, quality gates, and data-driven prioritisation.

Collapse

What happens when refactoring keeps getting deferred?

Expand

What is the difference between a refactoring sprint and continuous refactoring?

Expand

How do you prioritise which refactoring to do first?

Expand

Know what in your codebase should be refactored first?

Connect your repo and get a prioritised list of the files producing the most friction — ranked by coupling, churn, and test coverage gaps. Know where to start before your next sprint.

Get Your Free Diagnosis

Share this article

Help others discover this content

TwitterLinkedIn
Categories:Engineering PracticesCode QualityEngineering Leadership