Every team with an old system eventually has the same conversation: should we just rewrite it? The appeal is obvious. A clean codebase, modern tools and none of the workarounds that built up over ten years.
The trouble is that a full rewrite asks the business to wait. For months, sometimes years, the team builds a replacement that delivers no value until it is finished, while the old system still needs fixes and keeps gaining features the new one must copy. Many rewrites are cancelled, delayed or launched with missing behaviour that nobody knew the old system had.
There is a safer way: replace the system in small pieces, with the old and new running side by side until each piece is proven.
The strangler fig pattern
The name comes from Martin Fowler, who compared it to a fig that grows around a host tree until the tree is no longer needed. In software, it works like this:
- Put a routing layer in front of the legacy system. At first it sends everything to the old code.
- Build one capability in the new system, such as customer search, invoicing or a reporting screen.
- Route the traffic for that capability to the new code. Everything else still goes to the old system.
- Repeat until nothing is left in the old system, then switch it off.
Each step is small enough to release, measure and roll back. The business gets improvements every few weeks instead of waiting for one big launch.
Step 1: Map before you move
Before writing new code, spend a few weeks understanding what you have:
- Capabilities. List what the system does in business terms: take orders, calculate prices, generate invoices, send reminders.
- Dependencies. Which parts call which, which share database tables, and which external systems connect in.
- Usage. Logs and database statistics show which screens and jobs are actually used. It is common to find large parts nobody uses any more, which you can retire instead of migrating.
- Pain. Ask the people who use and support the system where it hurts most.
The result is a migration map: an ordered list of slices, each with its dependencies and a reason to go early or late.
Step 2: Choose the first slice carefully
The first slice proves the approach, so pick something that is:
- Valuable enough that people notice the improvement.
- Contained, with few dependencies on the rest of the system.
- Low risk, so a problem doesn't stop the business.
Reporting and read-only screens are often good first candidates. They can read from a copy of the data without changing how the old system writes it.
Step 3: Handle the data
Data is usually the hardest part. Two patterns cover most cases.
Sync from the old database. Change data capture (CDC) tools such as Debezium read the legacy database's change log and stream every insert and update to the new system. The new code can read current data without the old system knowing it exists.
Move ownership one entity at a time. When a slice starts writing data, decide which system owns that data. During the transition, the owner writes and the other side receives a copy. Never let both systems write the same record independently.
Whatever pattern you use, write reconciliation checks that compare the two systems every day: record counts, totals and a sample of individual records. Differences should raise an alert, not wait for a customer to notice.
Step 4: Release safely
- Feature flags let you route a small share of users, or only internal staff, to the new code first.
- Parallel runs send the same input to both systems and compare the outputs before the new result is used. This is especially useful for calculations such as pricing, payroll or tax.
- Fast rollback means flipping the route back to the old system in minutes, without a deployment.
Step 5: Retire as you go
A migration isn't finished when the new code works. It is finished when the old code is deleted. Remove each legacy capability once its replacement has run cleanly for an agreed period. Otherwise you end up maintaining two systems indefinitely, which is worse than the one you started with.
When a rewrite is the right call
Incremental replacement is not always the answer. A rewrite can make sense when the system is small, when the platform it runs on is no longer supported and can't be bridged, or when the business process itself is changing so much that the old behaviour doesn't need to be kept. Even then, keep the rewrite short and release it in stages where you can.
What it looks like in practice
For an established business, a typical modernisation runs as a series of slices released every few weeks over several months. Teams often move to the cloud at the same time, with infrastructure as code and monitoring set up from the first slice, so each new piece arrives with better observability than the part it replaces.
This approach suits industries where downtime is expensive, such as manufacturing, where plant systems must keep running, and FinTech, where every balance must still reconcile on the day of the switch.
If you're weighing a rewrite against an incremental migration, our technology transformation team can start with a short assessment and a written roadmap. Get in touch to talk it through.