Replacing a system that is still in use
A full rewrite has to reproduce the old system while the business continues changing it. Requirements discovered during development can keep moving the finish date, especially when important rules exist only in the code.
Replacing smaller parts lets users try the new software sooner. It also gives the team a narrower set of behavior and data to compare before each switch.
Why big-bang rewrites stall
The target keeps moving
A business does not stop while you rebuild its software. Pricing changes, a new market needs a new tax rule, a large customer gets a special contract. All of that goes into the old system, because the old system is what runs the business. The new system has to catch up with each change, so the finish line drifts away at roughly the speed you run toward it.
The old code knows things nobody wrote down
A system that has run for ten years contains hundreds of small decisions: a rounding rule added after an angry customer call, a check that blocks a rare data combination, a workaround for a partner API that misbehaves on the first of the month. None of this is in the specification, because the specification was written before any of it happened. A rewrite built from documents quietly drops these behaviors, and you find out in production.
Nobody sees value until the end
For months the rewrite produces nothing anyone outside the team can use. Budget gets spent, confidence drains, and the project becomes easy to cut in the next planning cycle. If it survives, it ends in one large cut-over weekend where every gap shows up at once.
The strangler fig approach
Martin Fowler named this pattern after a fig that grows around a host tree, gradually taking over until the original tree is gone and the fig stands on its own. The software version works the same way.
- Put a layer in front of the old system. This is usually a proxy, an API gateway or a routing layer in the web tier. At first it forwards everything to the legacy application unchanged. Users notice nothing.
- Rebuild one piece behind that layer. Pick a single capability, such as invoice generation or the customer profile page, and build it properly in the new stack.
- Route that piece to the new code. The layer sends those requests to the new implementation and everything else to the old one.
- Repeat, then retire. Each piece you move is one piece the old system no longer does. When nothing routes to it anymore, you switch it off.
The appeal is not elegance. It is that the system works at every stage. You can pause the project for a quarter without leaving anything half-built, and every move delivers something real.
Choosing the first slice
The first piece sets the tone, so it deserves more thought than it usually gets. Teams are tempted to start with the most painful module, the one everybody hates. Resist that. The worst module is usually the worst because it is tangled with everything else, and starting there turns your first step into a mini rewrite.
A good first slice is:
- Small enough to finish in weeks, so the team and the business see the approach working early.
- Valuable on its own, for example a slow report that users complain about, so the move has a visible benefit beyond cleaner code.
- Well understood, with clear inputs and outputs and few hidden rules.
- Loosely coupled, reading and writing a limited part of the data.
Read-heavy features are often the easiest start. A new reporting view or search page can read from the same database as the old system without changing how data is written, which keeps the risk low while the team builds the routing, deployment and monitoring the later steps will need.
Running old and new side by side
The safest way to move a piece is to run both versions before switching. There are two common ways to do it.
Shadow mode
Real requests go to the old system as usual, and a copy goes to the new code. Users only ever see the old result. You log both outputs and compare them. Every difference is either a bug in the new code or one of those undocumented rules from the old one, and both are worth finding before customers do.
Gradual rollout
Once the outputs match, start sending a small share of real traffic to the new implementation, then more, watching error rates and business metrics at each step. If something goes wrong, the routing layer sends everything back to the old path in seconds.
Data: the part that decides the project
Moving code is the visible part. Moving data is where most of the risk sits.
In the early stages the old and new code often share the same database. That is fine as a starting point, but it ties the new system to the old schema. At some point each moved piece should own its data, which means a migration.
Treat data migration as a process, not an event:
- Copy, then keep in sync. Load historical data into the new store, then keep it updated from the old one until the switch.
- Reconcile, do not just import. Compare record counts, totals and key fields between the two stores after every load. A migration that completes without errors can still be wrong.
- Decide who owns writes. At any moment, exactly one system should be the source of truth for a given record. Two systems writing the same data is how duplicates and lost updates happen.
- Keep a way back. Until the old store is retired, be able to rebuild the new one from it.
Knowing when to switch the old part off
A piece is ready to retire when three things are true. Nothing routes to it anymore. The new implementation has handled real traffic through at least one full business cycle, including month-end or seasonal peaks. And the comparison logs show no unexplained differences.
Then remove it for real. Delete the code, drop the tables after archiving them, remove the routes. Old code that is "turned off but still there" has a habit of being turned back on by someone in a hurry.
Traps worth avoiding
- Adding features to both systems. During the transition, new features should go into the new stack wherever possible, or the old system keeps growing.
- Letting the routing layer become a second legacy system. Keep it thin. Its only job is deciding where requests go.
- Stopping halfway. Running two systems indefinitely costs more than either one. Plan the retirement of the old platform as a real milestone with a date.
- Skipping observability. You cannot compare old and new behavior if you cannot see either clearly. Logs and metrics come before the first move.
The same thinking applies beyond web applications. When we re-architected a multi-tenant SaaS for ten times its traffic, described in the scaling case study, the work happened while the product kept serving customers.
Choose the first part to replace
List the capabilities of your legacy system on one page: what it does, who uses each part, and how often each part changes. Mark the ones that are small, valuable and well understood. That short list is your candidate first slice. Our page on legacy application modernization explains how we usually approach it.


