Rewrite or refactor? How to decide before you burn six months

Sooner or later someone on the team says the codebase has to be rewritten. It sounds reasonable. The code is messy, the framework is old, and everything feels slower than it should.

It's also one of the riskiest decisions a company can make, because the old system keeps running while the new one gets built, and the new one will take longer than promised.

Why rewrites usually disappoint

A mature system contains years of small fixes for odd cases that nobody wrote down. A rewrite has to rediscover each of them. Meanwhile, customers wait for features, the team splits its attention between two systems, and the new code slowly accumulates its own mess. Many rewrites end up recreating the old problems with newer tools.

When a rewrite is justified

Rewrites make sense in a few situations:

  • The platform is dead or unsupported, and security fixes are no longer available.
  • A fundamental assumption has changed. The product was built for one customer and now has to serve thousands, and the data model can't stretch.
  • The code is so poorly understood that every change is dangerous, and tests can't be added.
  • The technology prevents hiring. You can't find or keep people who know it.

Notice what's not on the list: "the code is ugly," "we'd do it differently now," or "a new framework is exciting."

The middle path

Most systems benefit from incremental improvement instead:

  1. Add tests around the parts you rely on. They make everything else safer.
  2. Fix the worst hotspots. The few files that cause most bugs and delays deserve attention first.
  3. Replace one piece at a time. Pull out a single module or service and rebuild it behind a clean boundary, while the rest keeps running.
  4. Upgrade dependencies steadily. Small, regular updates are far cheaper than a massive catch-up.

This approach, often called strangling the old system, delivers value continuously and lets you stop at any point.

Questions to ask before approving a rewrite

  • What specific business problem does it solve, and how will we measure it?
  • What will the team not build while this happens, and for how long?
  • Has anyone listed every behavior the old system has that the new one must match?
  • Could we get 80 percent of the benefit with targeted refactoring?
  • What's the plan if the rewrite is half done and we have to stop?

If the answers are vague, that's your answer.

Get a second opinion

The engineers proposing a rewrite are often right that something is wrong, and wrong about the best fix. An outside review of the code, the pain points, and the options can separate real structural problems from frustration. It's cheap relative to the cost of a six-month detour.

The takeaway

Treat a rewrite as a last resort with a clear business case, and treat steady refactoring as the default. Your customers care about what the product does, and rarely about what it's written in.

Previous
Previous

What investors and acquirers look at in technical due diligence

Next
Next

How to hand off a software project so it survives you leaving