Software Rewrite Strategy
Strategy here is mostly a sequence of decisions: whether to do large work at all, what to touch first, how to make each change safe, and how to prove it is working to people who cannot read the code. This is the framework from The Rewrite Trap, in the order you need it.
Decision 1: Is the system actually the problem?
Separate two statements that get conflated constantly:
- This system is unpleasant to work with.
- This system is preventing the business from operating or growing.
If the second is not true, stop. Do not approve large work. "This feels gross" is not a business case, and rewriting code purely because it is sloppy is how teams end up spending a year to arrive where they started.
Decision 2: Diagnose before you modernize
Teams often jump to solutions before fully understanding the causes. If you do not understand why a process breaks or slows down, replacing it is a gamble. If an engineer suggests rewriting a feature they do not understand, push back.
Ask:
- What fails, exactly, and how often?
- Does it break at a particular data size or traffic level? Are you seeing timeouts or running out of memory?
- Is the delay in the software, the workflow, or the handoff between teams?
- Who has to work around it: customers, employees, or both?
If your team cannot answer, you do not have enough information to approve a replacement. Diagnosis used to be a roadblock; it is the thing AI is good at, so there is less excuse for skipping it than there was.
Isaac worked at a fintech company that planned to rewrite a dated service wrapping a popular banking API. The code was almost a decade old, had no test coverage, and moved money between customers and the company's bank. The estimate to rewrite it on a modern architecture was four months. Isaac asked what the main reason for updating was. The team could not upgrade to a newer version of the banking API's library without a major version bump to their programming language, and the service was too far out of date for that to be easy. After digging, it turned out only two of the library's endpoints were needed for money movement, and that the library was a convenience: basic signed requests could call the banking API's updated endpoints directly, with no library installed at all. The team refactored those two areas instead of rewriting the service. That bought time to plan the language upgrade and removed the incentive for a wholesale rewrite.
Decision 3: What does fixing it cost?
Before committing to large, irreversible work, check whether cheaper leverage is still available. Sometimes the complaint is really about a job people have to do by hand. Shadow them, find the step that takes the most time, and ask whether a small amount of effort could replace most of it. You cannot justify replacing an old system just because someone has to babysit part of it. Fixing that part may be enough.
If a small improvement removes 90% of the pain, that may buy enough time to understand whether more of the system needs dramatic change. Use that time to prepare for the next limit you know is coming, or to revisit the decision when you know more about what the business needs. Even when you do know, consider the smaller improvements first in case those needs change.
Decision 4: Is modernization earned?
Signals that it is:
- The system cannot handle customer demand reliably.
- Operating costs are growing faster than revenue or usage.
- The same underlying failures keep causing incidents.
- The architecture repeatedly blocks needed features.
- A compliance deadline, an infrastructure limit, or the end of support for a required dependency forces a change.
Even with these present, ask what has to change to remove the constraint, and pick the narrowest modernization that does it. A deadline for one dependency does not automatically justify replacing the whole application. Ask which smaller fixes the team has tried and why they are no longer enough.
Decision 5: What do you touch first?
A rewrite answers this for you: start at line one. Iterative work does not, and the obvious answers are wrong. "Everywhere" is the same as nowhere. "Whatever feels exciting" puts the team's interest ahead of the system's. "Whatever's most broken" confuses urgency with importance.
Approach it scientifically. Form a theory about which single problem, once fixed, would help most. The theory does not have to be right; it has to find leverage. Look at modules with frequent changes, repeated outages, slow performance, or a heavy support burden. Reducing support burden often has the highest leverage, because it improves customer happiness and frees resources at the same time.
Then gather evidence by talking to the people who feel the pain: which complaints recur, what costs time or money, what slows releases. And go to the actual source. One team spent months on a framework-first plan because "the CEO is personally embarrassed by the load time," which turned out to be an intermediary's reading of a stakeholder nobody had checked with. The plan collapsed into a rewrite and derailed four separate times. One conversation would have saved months.
Pick a first target that is:
- Low risk. Failure will not bring down the system.
- High visibility. Users should notice if it works.
- Well understood. The team knows how it behaves and why.
- Painful enough. It is clearly causing trouble now.
A good first experiment is an area that works fine normally but breaks under heavy load: a file import that works at small sizes, or a page that loads contacts but struggles for your largest customers. Avoid core billing flows and fragile infrastructure. They matter more, which is exactly why they make bad experiments. Work on those after lower-risk deliveries have proven the method.
Decision 6: How do you replace it safely?
- Isolate the boundary. Wrap the target behind a clean API. If you cannot isolate it, you are not ready to replace it.
- Capture behavior in tests. Characterization tests describe what the code does, quirks included, not what it should do.
- Replace behind a flag. Match behavior, not internals.
- Run in parallel. Same inputs to both, compare until they agree.
- Flip gradually. Internal users, a slice of traffic, then everyone, with a fast rollback.
- Tear out the old code. Delete it; source control remembers. Remove toggles and scaffolding. Update the docs.
Before step 4 begins, name the person responsible for retiring the old implementation, agree on the evidence needed to do it, and set a date to review the results. Parallel runs are a safety mechanism, not an architecture. Leaving both versions running indefinitely is a decision too, with a maintenance cost you should make explicit.
Decision 7: How do you prove it is working?
The biggest risk in the incremental path is perception. A rewrite comes with a bold narrative and manufactures a feeling of momentum even when no customer sees anything for months. Steady improvement only looks impressive in hindsight, but it is measurable while it happens.
Track the four DORA metrics: deployment frequency, change lead time, change failure rate, and failed deployment recovery time. All four are legible to non-engineers and commercial tools will chart them for you.
Three softer signals track the team, not the system: fewer "do not touch" areas (can more than one developer safely change the component everyone used to avoid?); fewer surprises in feature work (if the same poorly understood component adds time to every feature, improving it should make estimates more dependable); and maintenance leaves room for planned work.
The six ways this strategy goes wrong
Teams rarely fail because they started in the wrong place. Failure creeps in as discipline erodes:
- Straddling two horses. A parallel run that nobody finishes. Both implementations need maintenance, and each new change adds work to the eventual cutover.
- Expanding the scope. After a few wins the team proposes replacing every remaining module and putting a date on the end of modernization. A stable component nobody needs to change can wait.
- Overbuilding the replacement. Configuration nobody requested, extension points with no consumers, abstractions for requirements that might arrive someday. It is the second-system effect inside a single module. Match the effort to the consequences of failure; a billing engine and a rarely used report need different levels of scrutiny.
- Mistaking invisible progress for no progress. Engineers notice when builds get faster and deployments less frightening. People outside the team see the same product and wonder where the time went. Report the DORA metrics and connect them to something the audience recognizes.
- Freezing in fear. The module too dangerous to touch. Characterization tests and boundaries are the way in. Start with enough protection to make one small change.
- Losing sight of the business. If every answer is about frameworks, architecture, and code quality, ask who is having a problem with the current system and what will improve for them.
What to leave alone
The discipline that makes this affordable is knowing what not to touch. Three kinds of problem justify going into a module: the code does not work consistently, the code needs updating for new business needs, or the code does not run fast enough. "The code is bad and developers hate it" is not on the list.
Bad code is an ambush predator. It does not come looking for you; it sits still until the day you have to walk into it, and if nothing forces you in it never bites. When something does force you in, a bug or a feature or a speed problem, that is the trigger, and you clean up while you are there.