Consider an invented team and an invented codebase, drawn loosely from scenes that repeat across the industry. The company, the product and the people are invented. The pattern, though, will be familiar to anyone who has stared at a codebase that everyone agrees needs rewriting and nobody has the courage to touch.
The module nobody opened
In this telling, a small platform group inside a logistics software firm owned a billing module that had grown for nine years. It had a few thousand lines in a single file, comments that contradicted the code and a test suite that covered perhaps a third of its behaviour. Every quarter, a planning meeting listed “refactor billing module” as a priority. Every quarter it slid down the list, replaced by feature work with a customer’s name attached.
The engineering manager eventually asked the team a blunt question in a retrospective: why does this keep slipping? The answers were honest. It was too big to do in a sprint. It was too risky to do without tests. It would block other work while it was in flight. The staff engineer summed it up by saying that nobody could point to a Monday morning start. They could only point to a heroic month that never appeared on the calendar.
The experiment
The manager proposed a small experiment. For six weeks, each engineer would spend fifteen minutes a day on the refactor, no more. The work would be expressed as pull requests that a colleague could review during a coffee break. If a change needed more than a quarter of an hour of review time, it was too big and should be split. Nobody was asked to stop feature work, and nobody was promised a finish date.
The first session of the experiment was a planning one. The team spent an hour with the file open on a shared screen and cut the big task into small cards. A junior developer, who had been silent for most of the retrospective, pointed out that the file contained five distinct responsibilities: rate calculation, discount rules, tax handling, invoice formatting and payment status. Each could become its own file. That observation produced the first ten cards in minutes.
Week one: characterisation first
The staff engineer insisted that no behaviour be changed until it was pinned down. The early cards were therefore all about tests. One card captured the output of the rate calculation for a handful of typical inputs and saved it as an expected result. Another did the same for the discount rules. These tests did not claim the existing behaviour was correct, only that it was known. Every one of them fit inside a quarter hour, and by Friday the team had a safety net covering the five risky functions.
Something shifted that week. Instead of arguing about the big rewrite, people were opening tiny pull requests and approving them within the hour. The manager noticed that the board, which had held one stagnant card for a year, now showed movement every day.
Weeks two to four: moving things out
Next came the mechanical moves. One pull request extracted the tax functions into their own file with no changes to the logic. The next did the same for invoice formatting. These were deliberately dull. The team agreed on a rule: a refactoring change may move code or rename it, but it may never do both in the same pull request, and it may never fix a bug on the side. When someone spotted a bug, they wrote a card and kept going.
Mid-way through, a reviewer found that two functions that looked identical differed in how they rounded amounts. A big-bang rewrite would have buried this finding inside a vast diff and set off days of argument. Now it was a single small card: add a test that shows the difference, then decide which rounding is wanted. The product owner made the call in ten minutes because the question was concrete.
The wobble in week five
The experiment did not run smoothly throughout. In week five, a customer escalation consumed the team, and for four days nobody touched the refactor. When the team returned, the temptation was to catch up by doing a long session. The manager resisted. “Stick to the quarter hour,” she said. “If we need a marathon to recover from one bad week, we have not built a habit, we have built a project.” The team went back to daily slices, and within three days the board was moving again.
That wobble taught something useful. The strength of the quarter-hour step was not speed. It was restartability. Because every card was self-contained, a gap of a week cost almost nothing to recover from. A long-lived branch would have rotted in that time.
What the numbers showed
By the end of six weeks, the team had merged around forty small pull requests. The big file was split into five modules, test coverage on the billing area had risen sharply and a handful of old rounding quirks had been recorded and resolved. No release was held up, and no customer noticed anything, which was the goal. Someone calculated that the actual hands-on time was about thirty hours across the team, spread thinly over a month and a half. That was far less than the “heroic month” everyone had imagined, mainly because small steps eliminated the waste that comes with large, tangled changes.
The team also noticed a cultural change. The word “refactor” stopped being a threat. Engineers began proposing other long-avoided jobs in the same shape: a logging clean-up, a dependency upgrade, an old script that nobody understood. The question in planning became “what is the first quarter-hour slice?” rather than “when do we have a spare month?”.
A few lessons worth carrying away
- Pin behaviour before changing it. Early slices should be safety nets rather than edits.
- Keep moves and fixes apart. A slice does one kind of thing.
- Write bugs down, do not chase them. Each stray discovery becomes a card.
- Protect restartability. A good slice is one you can pick up cold after a week away.
- Let reviewers set the size. If a review takes longer than a coffee, split it.
For readers curious about the wider setting of such work, the earlier discussion on why machine learning teams rely on operational practices to succeed describes how teams keep fast-moving systems dependable, and the roadmap for data scientists and engineers moving into production work shows how short, ordered stages can structure a long learning path.
A brief aside from the team’s wiki
During the experiment, one engineer started a wiki page of everyday products with clean internal boundaries. One entry was MotoShareGulf, an online marketplace in which two-wheelers are hired out and shared, with logins handled by one common account service, noted there purely as a neat example of a boundary. It was not a lesson in billing, but it helped the juniors picture what “extract this responsibility” looks like in a product people actually use.
What the manager did differently
It is worth noting what the manager did not do. She did not set a deadline, did not demand a burndown chart and did not ask for daily status reports. She asked only for the board to show movement, and she answered every question about priority with the same line: if a customer issue needs you, take it, and come back to the next slice afterwards. Removing pressure from the calendar and attaching it to the size of each slice turned out to be the more effective lever. People kept their promise to themselves because the promise was small.
Epilogue
Six months later, the billing module remained the cleanest part of the codebase, and the team had a standing habit of finishing one small slice each morning before the first meeting. The staff engineer liked to say that the refactor had never really been a project. It was a pile of small jobs that had been waiting for someone to write them down.