When I Would Not Rewrite a Legacy Software System
Old software is not automatically bad software.
Some systems look outdated, have awkward code and are difficult to change, but they still run important parts of a business every day.
Rewriting everything can feel like the cleanest solution. In practice, it can also be the most expensive and risky one.
Before I recommend a rewrite, I want to understand what is actually broken.
Ugly code is not enough reason to rewrite
I have inherited codebases that made me uncomfortable on the first read. Naming was inconsistent. Modules were tangled. Frameworks were years behind. None of that, by itself, means the system should be thrown away.
Old code often carries years of business decisions. Edge cases from real customers. Workarounds for partner APIs. Rules that never made it into a document, but that the business still depends on. When you rewrite, you do not only remove technical debt. You also remove working behaviour that people have come to rely on, whether anyone remembers why or not.
A system can be hard to maintain and still be the right foundation for the next stage of the product. Difficulty is a signal. It is not automatically a verdict.
Understand the system before replacing it
The codebase is only part of the system.
Before I talk about a rewrite, I want a clear picture of what surrounds the code. Critical workflows. Integrations with payment providers, CRMs, hardware or internal tools. Database shapes that other teams query. Undocumented rules that only show up when something fails in production. Operational habits: who restarts what, which jobs must finish overnight, which reports finance cannot live without.
I also look at how the system is used day to day. Which screens matter. Which paths are rare. Where people have already built manual process around the software. That context decides whether a rewrite is surgery or demolition.
If nobody can explain the integrations, the data contracts and the operational load, a rewrite starts from fiction. Fiction is expensive.
Refactoring can be safer than rewriting
Often the better move is not a blank repository. It is a sequence of controlled improvements that reduce risk while the business keeps running.
That can mean isolating a high-risk module behind a clearer boundary. Introducing an API around a legacy workflow so new features do not have to touch the old core. Replacing one component at a time: auth, reporting, a single product surface. Improving deployment and infrastructure without rewriting the domain. Raising observability so you can see failures before you change behaviour.
Incremental work feels slower at the start. It is usually faster at delivering safe change, because you keep proving the system in production as you go. A big rewrite asks the team to be right about everything before users ever touch it again.
I also look at whether the team can ship small releases with confidence today. If deployments are painful, tests are thin and rollback is unclear, a rewrite on top of that process multiplies risk. Sometimes the first modernization win is making the current system safer to change.
Protect the data first
Application code is often easier to replace than the database underneath it.
Schemas accumulate history. Columns that mean different things in different eras. Rows that never matched a clean model. Reports and partner feeds that depend on shapes nobody wants to break. Migrations that look simple on paper and fail on real volumes.
A new application with a badly planned migration can create more problems than the legacy application it replaces. I treat data design, dual-write periods, backfills and compatibility as first-class work, not a cleanup task at the end.
If the rewrite plan is vague about data, the rewrite plan is not ready.
Rewrite when the reason is strong enough
I am not against rewrites. I am against rewriting because the code looks old.
I will consider a rewrite when the architecture fundamentally blocks the product, when security risk cannot reasonably be fixed in place, or when the core technology is unsupported and every change becomes a gamble. I will also consider it when change has become consistently dangerous, when the system cannot meet the reliability or scale the business now needs, or when the business model has changed enough that the old architecture no longer fits.
Those are engineering and business reasons. They are stronger than taste. When they are present, a rewrite can be the honest path. When they are not, a rewrite is often a way of avoiding harder questions about scope, data and delivery.
The decision also has to survive contact with reality. If the product still needs weekly changes while a rewrite is underway, someone has to maintain the old system and build the new one. That dual load is part of the cost. Ignoring it is how timelines break.
A migration should have stages
When replacement is the right call, I still want stages, not a single cutover fantasy.
Understand → Stabilize → Separate → Replace → Migrate → Retire
Understand what the system really does. Stabilize production so you are not redesigning during constant firefighting. Separate boundaries so pieces can move independently. Replace the parts that earn replacement. Migrate data and traffic with room to roll back. Retire the old path only when the new one has proven itself.
The sequence is simple on purpose. The hard part is discipline: not skipping stabilize, not skipping data work, not declaring victory because the new UI looks cleaner.
What I usually look at first
When someone asks me whether to rewrite, I start with questions like these:
- What actually causes problems today?
- Which parts change most often?
- Which parts rarely change?
- Where are production incidents coming from?
- What depends on the current database?
- Which integrations cannot break?
- Can parts of the system be replaced independently?
- What would happen if the rewrite took twice as long as planned?
The answers usually point to a narrower target than “rewrite the whole thing.” Sometimes they point to infrastructure. Sometimes to one domain. Sometimes they confirm that a full replacement is justified. Either way, I would rather decide with that map in hand than with a feeling that the code is embarrassing.
Decide with clear eyes
A rewrite should be a business and engineering decision, not an emotional reaction to old code.
Sometimes the right answer is a new system. Often the better answer is to understand what already works, improve the parts that are holding the business back and replace things gradually.
