Modernising a legacy application without a big-bang rewrite

The strangler fig pattern replaces a legacy system one capability at a time. How to find seams, move data without losing the way back, sequence the work, and measure whether the old system is really shrinking.

The case for a full rewrite usually sounds tidy. The old code is hard to change, the platform is out of support, and starting fresh looks faster than untangling it. The trouble shows up later. Martin Fowler's summary is short: replacing a serious IT system takes a long time, and the users can't wait for new features [1]. While the rewrite is under way, the old system keeps changing, and the target moves.

Thoughtworks' Ian Cartwright, Rob Horn and James Lewis name a second trap in their patterns of legacy displacement. Many failed efforts began by promising the business exactly what it had today, and they found that defining and agreeing the current "as is" functionality was itself a huge effort [2]. Feature parity sounds like a safe goal. In practice it commits a team to rebuilding behaviour that nobody has written down, including the parts nobody uses.

The alternative is to replace the system a piece at a time while it keeps running.

The strangler fig pattern

Fowler named the approach after the strangler figs he saw in Queensland's rainforests: vines that germinate in a nook of a host tree, draw on it until they reach the ground and the canopy, and then become self-sustaining [1]. In software, new components are built around the edges of the old system and take over its work gradually. Fowler's argument for it is about risk and timing: each step is small, the team learns as it goes, and value arrives earlier instead of at the end [1].

Microsoft's Azure Architecture Center describes the mechanics in four stages [3]:

1. client -> facade -> legacy (most routes)      new (first routes)
2. client -> facade -> legacy (fewer routes)     new (more routes)
3. client -> facade ---------------------------> new (all routes); legacy decommissioned
4. client ------------------------------------> new; facade removed or kept as an adapter

A facade (a proxy) intercepts requests and routes each one to the legacy system or the new service [3]. Clients keep using the same interface. As each capability moves, the facade's routing table changes, and eventually the legacy system has no work left.

The same guidance is clear about where the pattern does not fit: when requests to the back end cannot be intercepted, when you cannot change the legacy system or any integration point such as its database, when the system is small enough to replace whole, or when the original must be decommissioned quickly [3]. Check these before committing to it.

Finding the seams

Michael Feathers' definition, quoted by Fowler, is the working one: "a seam is a place where you can alter behavior in your program without editing in that place" [4]. Feathers was writing about code and tests. At the scale of a whole application, the useful seams are the places where traffic or data already crosses a boundary:

  • Inbound HTTP or RPC routes. The natural place for the facade.
  • Messages and files. Queues, batch file drops and scheduled jobs. Cartwright and colleagues describe event interception: intercept updates to system state and route some of them to a new component [2].
  • Internal module boundaries. Where no external seam exists, create one inside the code with branch by abstraction: put an abstraction in front of the part being replaced, move all callers to it, build the new implementation behind it, switch, then delete the old one [5].
  • The database. Often the only integration point a database-centric system has. Azure notes that when logic lives in stored procedures, the database itself can notify new services, for example from triggers or change data capture [3].

Where the new and old systems must call each other during the migration, Azure recommends an anti-corruption layer that translates between them, so that legacy conventions do not leak into the new design [3]. Cartwright and colleagues describe the mirror case, legacy mimic, in which the new system behaves so that the old one is unaware anything has changed [2].

Data decides the pace

Moving request routing is the easy half. The hard half is moving the system of record: the store whose data is authoritative for a domain. Until that moves, the new service is a new front end on old data.

Azure's database example breaks this into three phases [3]:

  1. The new service handles requests for its domain but still reads and writes the monolithic database.
  2. A separate domain database is introduced. Historical data is loaded with an ETL job, change data capture keeps it in sync, and consistency between the two is validated before cutover.
  3. After validation, the domain database becomes the system of record, and the legacy tables and procedures for that domain are removed.

The important detail is the rollback window. Rolling back is possible during phase 2 and at the start of phase 3, while the legacy objects and sync still exist. Once they are removed, going back means restoring objects and replaying changes, so Azure advises treating removal as a deliberate final step taken only after validation [3].

Within a schema, the same discipline is called parallel change, or expand and contract: add the new structure beside the old, migrate clients over, then remove the old structure once nothing uses it. Danilo Sato notes that most database refactorings follow this shape [6]. Each schema change becomes a series of small, separately deployable steps, and every intermediate state is one the running system can live with.

Before switching traffic, two verification techniques reduce surprises. Parallel running keeps both implementations working on the same input so that key numbers can be checked against each other, and can stay in place for a while with an alert if the two start to diverge [8]. Dark launching calls the new back end from real traffic without using its output, to see the load and performance impact before anyone depends on it [7]. Comparing outputs is also how teams discover the undocumented behaviour that the feature-parity approach would have had to specify up front.

A worked sequencing example (illustrative)

The order-management system, its six capabilities and every score in this section are invented for illustration. They do not describe a client, a Daivota project or measured data. Take an order-management monolith with six capabilities sharing one database, and score each on four questions, from 1 (low) to 3 (high):

CapabilityChange demandBusiness value of movingData coupling (writes shared tables)Cut-over riskSeam available
Product catalogue (read)3211HTTP routes
Customer notifications2211Order-status events
Pricing and discounts3322Internal module (branch by abstraction)
Order capture2333HTTP routes plus shared tables
Invoicing1233Nightly batch
Management reports1111Read replica

A simple rule of thumb orders the work: start where change demand is high and coupling and risk are low, so that the first steps both prove the facade and pay for themselves.

  1. Catalogue reads first. Read-only, high change demand, a clean HTTP seam. This step builds the facade, the deployment pipeline and the monitoring that every later step reuses.
  2. Notifications second. Intercept order-status events and send them to a new service. Nothing writes back, so rollback is a routing change.
  3. Pricing third. High value, but its callers sit inside the monolith. Introduce an abstraction in the legacy code, run the new pricing engine in parallel, compare results on live orders, then switch [5][8].
  4. Order capture fourth. The first capability that moves a system of record. Use the three database phases above, with an explicit rollback window, and expand-and-contract changes to the shared tables [3][6].
  5. Invoicing last among the core flows. Low change demand and high risk. If invoices carry tax or statutory obligations, involve finance and check the requirements with counsel before changing how they are produced.
  6. Reports whenever convenient. They can read from a replica of whichever store is the system of record at the time.

In this illustrative scoring, pricing scores higher on value than catalogue does. It still goes third, because the first step is also where the team builds the facade and learns the legacy system's behaviour, and that is cheaper to learn on read-only traffic.

Measuring whether the old system is shrinking

Modernisation programmes are easy to report as activity and hard to report as progress. The measures below are ours; they are chosen because each one moves only when legacy responsibility actually goes away.

MeasureWhat it tells youWhy it resists gaming
Share of requests per capability served by the new pathRouting progressRead from facade logs, not from plans
Capabilities whose system of record has movedData progressBinary per domain; the legacy tables are gone or they are not
Legacy code and database objects deletedReal shrinkageCounts removal, not new code
Parallel-run mismatch rate per capabilityReadiness to switchA falling trend is the evidence for cut-over
Transitional components still runningCost of the scaffoldingShould rise early and fall to zero

The last row matters because facades, adapters, sync jobs and comparison harnesses are real software. Fowler calls this transitional architecture and accepts its cost in exchange for lower risk and earlier value [1]. Cartwright and colleagues ask teams to be explicit and transparent about the trade-off between the value of risk mitigation and the cost of transitional architecture, and to quantify that value so that investment can be tracked against it [2]. Azure adds two operational points: make sure the facade keeps up with the migration, and make sure it does not become a single point of failure or a performance bottleneck [3]. The reliability practices in reliability practices for enterprise APIs apply directly to the facade.

Before you start

  • Write down why you are modernising in business terms. Cartwright and colleagues warn that adopting newer technology should not be the reason in itself [2].
  • Confirm that requests can be intercepted and that you can change the legacy system or its database [3].
  • Decide which capabilities you will retire rather than migrate. Some may be better replaced by a product; custom software or SaaS covers that decision.
  • Set an end condition for every transitional component when you create it.

Sequencing a programme like this is part of how we approach technology strategic planning, and the facade, pipelines and observability it depends on fall under cloud and DevOps engineering.

Prepared with AI-assisted research and drafting.

Sources

[1] M. Fowler, "Strangler Fig Application", martinfowler.com, 2024. https://martinfowler.com/bliki/StranglerFigApplication.html

[2] I. Cartwright, R. Horn and J. Lewis, "Patterns of Legacy Displacement", martinfowler.com, 2024. https://martinfowler.com/articles/patterns-legacy-displacement/

[3] Microsoft, "Strangler Fig pattern", Azure Architecture Center, Microsoft Learn, 2026. https://learn.microsoft.com/en-us/azure/architecture/patterns/strangler-fig

[4] M. Fowler, "Legacy Seam", martinfowler.com, 2024. https://martinfowler.com/bliki/LegacySeam.html

[5] M. Fowler, "Branch By Abstraction", martinfowler.com, 2014. https://martinfowler.com/bliki/BranchByAbstraction.html

[6] D. Sato, "Parallel Change", martinfowler.com, 2014. https://martinfowler.com/bliki/ParallelChange.html

[7] M. Fowler, "Dark Launching", martinfowler.com, 2020. https://martinfowler.com/bliki/DarkLaunching.html

[8] I. Cartwright, R. Horn and J. Lewis, "Divert the Flow", Patterns of Legacy Displacement, martinfowler.com, 2022. https://martinfowler.com/articles/patterns-legacy-displacement/divert-the-flow.html