Rewrite vs refactor: why full rewrites so often go wrong
When a codebase becomes painful, the temptation to start over is strong. Full rewrites do sometimes succeed, but they fail often enough that it's worth understanding why.
Why rewrites are risky
- Hidden knowledge: old code contains years of bug fixes and edge cases, many undocumented. A rewrite has to rediscover them.
- Frozen product: while the rewrite happens, the existing product gets fewer improvements, giving competitors an opening.
- Moving target: the old system keeps changing, so the new one has to keep catching up.
- Underestimated scope: teams estimate what they remember, not everything the system actually does.
- Big-bang switchovers concentrate risk into one launch.
Incremental alternatives
- Refactor in place: improve the worst areas step by step, backed by tests.
- Strangler pattern: build new components alongside the old system and gradually route functionality to them until the old parts can be removed.
- Rewrite one module with clear boundaries instead of everything.
- Add tests first around critical paths so changes are safer.
When a rewrite might be justified
- The underlying platform or language is no longer supported.
- The product's core model has fundamentally changed.
- The system is small enough that a rewrite is genuinely short.
Questions to ask before deciding What exactly is painful? Can that specific pain be fixed without replacing everything?
Have you lived through a full rewrite? Did it deliver what was promised, and how long did it take versus the estimate?
Comments · 3
The old "Things You Should Never Do" argument about Netscape still holds. Rewrites throw away years of bug fixes that nobody remembers but users depend on.
Been there. We chose a rewrite and shipped nothing new for a year while competitors moved on. Strangling the old system piece by piece would have been the saner path.
As someone learning, refactoring with tests first is the bit I appreciate. It makes the scary change feel small.