Strangler Fig Pattern for Legacy Modernization: How to Replace a System in Stages

What the strangler fig pattern is

The strangler fig pattern replaces a legacy system one piece at a time instead of all at once. The name comes from the vine that grows around a host tree until the tree is no longer needed. In software terms, you build new functionality next to the old system, move one capability over, and repeat until the old system has nothing left to do and can be switched off.

This is what makes it a phased legacy migration approach rather than a big-bang rewrite. The business keeps running on the old system while the new one takes over in stages. If a stage goes wrong, the old path is still there. That is why teams in banking and insurance, where downtime is expensive, tend to prefer it. Our guide on modernizing a legacy system without disrupting business operations covers the wider picture.

Why you need a map before you cut anything

The pattern only works if you know where the seams are. To move one capability out of a legacy system, you have to know what that capability reads, what it writes, which screens and batch jobs call it, and which business rules are buried inside it. In a system with decades of accumulated logic, the original developers are often gone and the documentation is incomplete or wrong.

If you skip this step, the usual result is a slice that looks small on paper but drags in a dozen hidden dependencies halfway through. The estimate slips and the team starts to doubt the whole approach. A clear map of the existing code and its dependencies is the foundation for every later decision, from choosing the first slice to deciding where the routing layer goes. Our piece on legacy code analysis explains how to build that understanding for a codebase you did not write.

How to pick the first slice

The first slice is a proof that the approach works in your environment, so it should be real but forgiving. A few things make a good candidate:

  • Few inbound and outbound dependencies, confirmed from the map rather than assumed.
  • Business rules that can be written down and checked against the old behavior.
  • Low enough risk that a rollback would be an inconvenience, not an incident.
  • Enough visible value that the business notices the result.

Avoid starting with the most tangled core of the system, even if it is the part everyone complains about. Start at the edges, prove the routing and the testing, and work inward. Before you migrate a slice, also check whether any of its code is dead weight. Our guide on finding unused code in a legacy system can shrink the slice before you move it, and change impact analysis shows what to check before touching a field.

Routing traffic between old and new

The routing layer is what lets two systems share one front door. Callers, whether users, other services, or batch processes, talk to a facade or proxy. For each capability, the facade decides whether the request goes to the legacy system or to the new component. At the start, everything goes to the old system. When a slice is ready, you flip the route for that capability only.

Some practical points make this safer:

  1. Keep the route switchable per capability, so one rollback never affects another slice.
  2. Move traffic gradually where you can, such as one internal user group first, then wider.
  3. Compare outputs from old and new for the same inputs before you retire the legacy path.
  4. Watch for shared data. If both systems write to the same tables during the transition, decide up front which one owns each record.

The comparison step matters most. Proving the new code behaves like the old is its own discipline, covered in our guide to testing a migrated legacy system for behavior parity.

Where AI-assisted discovery helps find clean boundaries

Finding boundaries by hand means reading code, and in a large estate that takes weeks before any new code is written. This is where AI-assisted discovery earns its place. Replai reads existing source in languages such as COBOL, Oracle Forms and PL/I, and builds a structured map of the business rules, workflows and dependencies between components. Your team can then ask plain-language questions about the code and trace how a change would ripple through the system.

For strangler fig work, that map answers the questions that decide the plan: which components are tightly coupled, which have a narrow interface, and which rules a candidate slice depends on. Clean boundaries show up as clusters with few connections to the rest of the system, and those are your first candidates. The result is a team that can plan slices from evidence instead of guesswork. For more on how this works, see how AI agents read legacy code, or compare options in our overview of rehost, refactor, rewrite and replace strategies.

Frequently asked questions

What is the strangler fig pattern in legacy modernization?

It is an approach where you build new functionality alongside a legacy system and move one capability at a time to it. Over time the old system handles less and less until it can be retired. The business keeps running throughout.

Why do I need to map the legacy system before starting?

To move a capability out safely, you must know what it reads, writes, and which business rules sit inside it. Without a map, a slice that looks small can pull in hidden dependencies and derail the plan.

How do I choose the first slice to replace?

Pick a capability with few dependencies, rules you can verify against the old behavior, and low enough risk that a rollback is manageable. Start at the edges of the system and work inward rather than tackling the tangled core first.

How does traffic get routed between the old and new systems?

A facade or proxy sits in front of both and decides, per capability, which system handles each request. Everything starts on the legacy path, and you flip the route for one capability once its replacement is verified.

How does AI-assisted discovery help with the strangler fig pattern?

It reads the existing code and builds a map of business rules, workflows and dependencies, so teams can see which components are loosely coupled. Those clean boundaries are the best candidates for early slices.

Is the strangler fig pattern safer than a full rewrite?

It limits risk because each stage is small and the old system stays available as a fallback. A full rewrite concentrates all the risk in one cutover.