Legacy System Modernization Without a Big-Bang Rewrite
How to modernize a legacy system step by step with the strangler fig pattern: choosing the first slice, handling data, testing old behavior, avoiding rewrites.
- Published
- Read
- 8 min
- By
- The Offbeat team
On this page+
- 01How do you modernize a legacy system without a full rewrite?
- 02Why do big-bang rewrites fail so often?
- 03What are your options for modernizing legacy software?
- 04How does the strangler fig pattern work in practice?
- 05How do you handle the database during modernization?
- 06Where should you start?
- 07Who should do the modernization work?
- 08How do you keep the business running during the work?
- 09How Offbeat Devs approaches it
The short answer
The safest way to modernize a legacy system is incrementally: put a routing layer in front of it, rebuild one well-bounded capability at a time, move traffic over gradually and switch off the old code once the new piece is proven. This is the strangler fig pattern, named by Martin Fowler. It delivers value early, keeps the business running and avoids the long, risky freeze of a big-bang rewrite.
Key takeaways
- 01Big-bang rewrites fail mostly because of hidden business rules and a moving target.
- 02Replace one capability at a time behind a routing layer.
- 03Write characterization tests to lock in what the old system actually does.
- 04The database is usually the hardest part, so plan data ownership early.
- 05Every slice should be releasable and reversible on its own.
Every legacy system started as someone's modern system. It made money, grew, picked up workarounds and now nobody wants to touch it. The tempting answer is to start fresh: freeze the old app, rebuild everything properly and switch over in one go. That plan fails often enough that experienced engineers treat it with deep suspicion. There is a better way.
How do you modernize a legacy system without a full rewrite?
You modernize incrementally, replacing one slice of functionality at a time while the old system keeps running. Martin Fowler named this the strangler fig pattern, after a vine that grows around a host tree until it can stand on its own. New code grows around the old system, takes over its responsibilities piece by piece, and the old code is removed as each piece is proven.
Why do big-bang rewrites fail so often?
Rewrites fail because the old system encodes years of business rules nobody wrote down, and the business keeps changing while you rebuild. Joel Spolsky's well-known essay on why rewriting from scratch is a strategic mistake made this point decades ago, and it still holds.
- Hidden rules. That strange if-statement handles a customer contract from years ago. The rewrite drops it and someone loses money.
- A moving target. The old system still needs fixes and features during the rewrite, so the new one is always chasing it.
- No value until the end. The business pays for months or years before getting anything back, and patience runs out.
- The parity trap. Teams spend most of the effort recreating features nobody uses, because nobody can prove they are unused.
- One risky cutover. Everything switches at once, so every bug appears at once.
What are your options for modernizing legacy software?
There is a spectrum from moving the system as it is to replacing it entirely, and most real projects mix several approaches for different parts of the system.
| Approach | What it means | Good when | Risk |
|---|---|---|---|
| Rehost | Move to new infrastructure with minimal code change | The pain is hardware, data center or hosting cost | Low, but fixes little in the code |
| Replatform | Upgrade runtime, framework or database version | The stack is going out of support | Low to medium |
| Refactor | Improve structure without changing behavior | The core design is sound but messy | Low per step, needs tests |
| Incremental replacement | Strangler fig: rebuild capabilities one by one | The design limits the business but the system must stay running | Medium, spread across many small steps |
| Replace with SaaS | Retire a module in favor of a product | The capability is commodity, such as billing or HR | Medium, mostly data migration |
| Full rewrite | Rebuild everything, switch over once | The system is small, well understood and well tested | High |
If a capability is commodity, replacing it with a product may beat rebuilding it at all. Our guide on custom software vs off-the-shelf can help you decide which parts are worth owning.
How does the strangler fig pattern work in practice?
It works by putting a routing layer in front of the old system, so each request can be sent to either the old code or the new code. The steps repeat for every slice:
- 01Map capabilities. List what the system does in business terms: quoting, invoicing, user management, reporting. Note dependencies between them.
- 02Add a facade. Put a proxy, API gateway or thin routing layer in front of the legacy system. At first it passes everything through unchanged.
- 03Pick a slice. Choose a capability that is well bounded, valuable and not the riskiest thing you own.
- 04Pin down current behavior. Write tests that capture what the old code actually does today, including the odd parts.
- 05Build the replacement in your new stack, with its own tests and monitoring.
- 06Shift traffic gradually. Route a small share of requests or a single customer segment to the new code, compare results, then increase.
- 07Remove the old code once the new slice has run cleanly for long enough. Skipping this step leaves you maintaining two systems.
How do you handle the database during modernization?
The database is usually the hardest part, because legacy systems often share one large schema that everything reads and writes directly. Code is easy to route; shared data is not.
A practical progression is to let the new code read from the existing database at first, through a translation layer that keeps the old data model from leaking into the new design. Domain-driven design calls this an anti-corruption layer. Over time, each new capability takes ownership of its own data, and you keep the old tables in sync using change data capture or events until no legacy code reads them anymore. Decide early which system is the source of truth for each piece of data at each stage, and write it down. Most modernization incidents come from two systems both believing they own the same record.
Where should you start?
Start with a slice that delivers visible value, has clear boundaries and will not take the business down if something goes wrong. Good first candidates are often read-heavy features such as reporting or search, new customer-facing screens that call existing logic, or a single integration that causes repeated incidents.
Avoid starting with the core transaction engine, the most tangled module or anything with heavy regulatory exposure. Learn the routing, testing and deployment mechanics on something forgiving first. If you do not yet know where the risk sits, a software audit is a good way to map it before committing to a plan.
Who should do the modernization work?
Modernization works best when people who know the old system work side by side with people who have done incremental migrations before. The legacy experts know which strange behaviors are load-bearing; the migration specialists know how to build the routing, testing and data sync without stopping delivery.
Avoid splitting the work into a new team building the future and an old team maintaining the past. That split breeds resentment, the knowledge never transfers, and the old team keeps adding features the new team must then chase. Rotate people between both sides, and make the people who will own the new system part of building it.
How do you keep the business running during the work?
You keep the business running by making every step small, observable and reversible. That means feature flags to switch traffic back instantly, monitoring on both old and new paths, and parallel runs where both systems process the same input and you compare the results before trusting the new one.
- Agree on a rollback plan for each slice before it goes live.
- Compare old and new outputs automatically during the transition.
- Keep releasing business features, ideally on the new side, so the work is visibly valuable.
- Report progress as capabilities moved and old code deleted, not as percentage complete.
- Watch for warning signs: no old code removed in months, the facade gaining business logic, or two teams fixing the same bug in two places.
Modernization is a long engagement, so the partner matters. Our guide to choosing a software development partner lists the questions worth asking.
How Offbeat Devs approaches it
We prefer incremental modernization because it keeps risk small and value visible. If you have a system that has become hard to change, our legacy modernization service starts with mapping what you have, and you can reach out here to discuss it.
Frequently asked questions
What is the strangler fig pattern?
The strangler fig pattern is a way to replace a legacy system gradually. A routing layer sits in front of the old system, and individual capabilities are rebuilt and switched over one at a time until the old system can be removed. Martin Fowler named it after a vine that slowly grows around a host tree.
Should I rewrite my legacy application from scratch?
Usually not, unless the system is small, well understood and well tested. Full rewrites tend to miss undocumented business rules, run long while the old system keeps changing, and end in a risky single cutover. Incremental replacement delivers value sooner with much lower risk.
How long does legacy modernization take?
It depends on the size of the system and how tangled its data is. The first slice often reaches production within a few months, and full modernization of a large system can take a year or more. The advantage of the incremental approach is that value arrives throughout rather than only at the end.
What is a characterization test?
A characterization test records what existing code actually does, rather than what it is supposed to do. You run real inputs through the legacy system, save the outputs and require the new code to produce the same results. The term comes from Michael Feathers' book Working Effectively with Legacy Code.
How do you migrate data from a legacy database safely?
Move data ownership one capability at a time, keep old and new stores in sync with change data capture or events during the transition, and define a single source of truth for each record at every stage. Run parallel comparisons before cutting over. Always test restores and rollbacks before go-live.
What are signs that a legacy system needs modernizing?
Common signs are a stack that is out of vendor support, changes that take far longer than they should, frequent incidents in the same areas, difficulty hiring people who know the technology, and integrations that are hard or impossible to build. Rising hosting or license costs can also be a trigger.
How we can help