Skip to content
Engineering7 min read

The full rewrite is the most expensive way to modernize a legacy system, and it fails more often than anyone admits. The strangler-fig pattern gets you the same destination while shipping value every month along the way.

Mira Kovačević

Principal Engineer

Every quarter, a company comes to us with the same plan: the old system is unmaintainable, so we are going to rewrite it from scratch. New stack, new team, new repository, clean slate. Eighteen months later, if the project survives that long, they have two systems, twice the operational load, and a business that stopped getting features the day the rewrite was approved.

We have inherited enough of these projects to say it plainly: the big-bang rewrite is the highest-risk move in software engineering, and it is almost never the right one.

Why rewrites fail

Rewrites fail for structural reasons, not because the team was bad.

  • The legacy system is a moving target. While you rebuild last year's behavior, the business keeps demanding changes, and every change either lands twice or widens the gap.
  • The old code is the spec. Fifteen years of edge cases, leap-year billing, that one enterprise customer's tax rule, the retry logic added after the 2019 outage, live nowhere else. A rewrite rediscovers them in production, one incident at a time.
  • The payoff is all-or-nothing. Value arrives only at final cutover, which means the project competes with every roadmap item for two years while delivering nothing. That is how rewrites get cancelled at 80 percent complete, which is worth exactly zero percent.

A rewrite asks the business to hold its breath for two years. The strangler fig lets it keep breathing while you replace the lungs.

What the strangler fig actually is

Martin Fowler named the pattern after a fig that grows around a host tree, roots itself, and eventually replaces the tree entirely. Applied to software, it means three commitments.

First, you put an interception layer in front of the legacy system, a reverse proxy, an API gateway, sometimes just a routing rule, so that every request can be directed either to the old system or to a new service, per capability, per route, even per customer.

Second, you extract one capability at a time. Not one module of code, one business capability: invoicing, notifications, product search. You build it as a well-bounded service, route traffic to it, and delete the corresponding legacy path once it holds.

Third, and this is the part teams skip, you actually delete the old code. A strangler migration that never decommissions anything is just a distributed monolith with extra hops.

Carving the first seam

Choosing the first capability to extract decides whether the program builds momentum or stalls. We score candidates on three axes: business value of changing it, risk of breaking it, and how cleanly it can be separated from shared state.

The ideal first slice is valuable enough that stakeholders notice, decoupled enough that you can ship it in six to eight weeks, and low-blast-radius enough that a rollback is boring. Read-heavy capabilities are ideal: product catalogs, search, reporting. They can be rebuilt against a replicated read model without touching the legacy write path at all.

What you should not pick first: authentication, billing, or anything that owns the customer master record. You will get there, around the middle of the program, once your routing layer, deployment pipeline, and observability have been proven on lower-stakes slices.

The routing layer is the whole game

The interception layer sounds like plumbing, but it is the control plane of the entire migration. It needs to do three things well.

  • Route by capability, with per-route configuration you can change without a deploy. A migration that requires a release to shift traffic will shift traffic about once a quarter.
  • Support percentage-based and cohort-based rollout, so the new invoicing service can serve 5 percent of tenants, then 25, then everyone, with instant rollback when the error budget says so.
  • Emit comparison telemetry. In shadow mode, the router sends the request to both systems, serves the legacy response, and logs any divergence between the two answers. Weeks of shadow traffic will surface edge cases no test suite ever would, and it turns the cutover decision from a debate into a dashboard.

Data is the hard part

Routing requests is easy; splitting data is where strangler programs earn their reputation. Our default sequence: give the new service its own store, hydrate it with a backfill, keep it current with change-data-capture from the legacy database, and only then flip writes. During the transition, one system must be the undisputed source of truth for each entity, dual ownership is how you corrupt data politely. We keep a written ledger of which system owns which entity at which date, and we treat changes to that ledger with the same ceremony as a production deploy.

How you know it is working

A healthy strangler program has a heartbeat you can measure monthly: percentage of traffic served by new services, lines of legacy code deleted, deployment frequency of the extracted capabilities, and incident rate on migrated versus unmigrated paths. If the legacy line is not going down, you are not modernizing, you are accumulating.

On a recent logistics engagement, the first extracted capability, shipment tracking, went from a two-week release cycle to daily deploys within a quarter, while the untouched monolith kept its cadence. That contrast did more for executive support than any architecture deck. Eighteen months in, the monolith was down to a scheduling core, and nobody had experienced a migration weekend, because there never was one.

The strangler fig is slower on paper and faster in reality. It converts a two-year bet into a sequence of eight-week wins, each independently valuable, each independently reversible. That is what modernization looks like when it is engineered rather than gambled.

Mira Kovačević

Principal Engineer

Mira has spent 14 years untangling systems other people were afraid to touch, from banking cores to fleet telematics. She leads Idealdevs' modernization practice and still writes production code every week.