Modernising Legacy Systems Without Stopping the Business

A practical guide to replacing aging systems in slices: the strangler fig pattern, data migration, risk control, sequencing and the metrics that show whether you are really making progress.

DIDatainter TeamSEP 30, 20259 MIN READTECHNOLOGY

Almost every company that has been operating for more than a decade depends on software nobody wants to touch. It might be a monolith written in a framework that lost community support years ago, a stored-procedure-heavy database that only two people understand, or a mainframe batch job that quietly moves millions of dollars every night. The system works, which is exactly why it is dangerous: it earns the right to be left alone while the cost of changing anything keeps growing.

Modernisation projects have a poor reputation for good reasons. The classic failure is the big-bang rewrite: a two-year parallel build, a frozen feature set on the old system, and a cutover weekend that either slips repeatedly or ships a product that lacks the hundreds of small behaviours the old one accumulated. This article lays out an approach that avoids that trap by replacing the system in slices, each of which delivers value and can be reversed.

Start by deciding why you are modernising

“The code is old” is not a business case. Before choosing a pattern, write down the specific pain you are trying to remove. Typical drivers include:

  • Delivery speed. A change that should take two days takes six weeks because of regression risk and manual testing.
  • Operational risk. Key-person dependency, unsupported runtimes, or hardware that can no longer be replaced.
  • Security and compliance. Libraries with known vulnerabilities that cannot be upgraded without breaking everything else.
  • Cost. Licensing, specialised hosting, or the premium paid for rare skills.
  • Strategic blockers. Inability to expose APIs, support a new market, or integrate with a partner.

Each driver implies a different target. If the problem is delivery speed, the goal is probably decoupling the parts of the system that change most often, not rewriting the stable parts. If the problem is a vendor end-of-life date, you have a hard deadline and the sequencing changes. Name the one or two outcomes that matter most, because they will decide what you do first.

The most expensive part of legacy code is not the code itself; it is the undocumented business rules hiding inside it.

Assess before you commit

A short, honest assessment of two to four weeks usually pays for itself. The output should be an inventory, not a slide deck.

Map capabilities, not modules

List what the system does in business terms: quote a customer, issue an invoice, reconcile a payment, produce a regulatory report. For each capability, record who uses it, how often it changes, how many other capabilities depend on it, and how well it is covered by tests. Capabilities that change often and have few dependants are the best early candidates. Capabilities that are stable, deeply entangled and rarely touched can wait, and sometimes should never be replaced at all.

Find the real interfaces

Legacy systems have more interfaces than the documentation admits: file drops, database links, shared tables read by reporting tools, scheduled jobs, email parsers. Trace them with network captures, database query logs and a review of cron and scheduler configurations. An integration you discover during cutover is an incident; one you discover during assessment is a ticket.

Capture behaviour with characterisation tests

When specifications are missing, the running system is the specification. Characterisation tests record what the old system actually returns for a broad set of inputs, including odd ones. They do not assert that the behaviour is correct; they assert that your replacement does the same thing, or that any difference is intentional and approved by someone who owns the business rule.

Technology · Modernising Legacy Systems Without Stopping the Business

The strangler fig pattern in practice

The strangler fig pattern, named by Martin Fowler after a vine that grows around a host tree, means placing a routing layer in front of the old system and gradually moving functionality behind it to new components. At any moment, each request is served either by the legacy system or by its replacement. When the last route moves, the old system can be switched off.

The mechanics are simple, but the details matter:

  1. Introduce a facade. An API gateway, reverse proxy or application-level router that currently forwards everything to the legacy system. Ship this first, with no behaviour change, so you learn about latency, authentication and headers while the stakes are low.
  2. Pick a thin vertical slice. A slice includes the user-facing endpoint, the business logic and the data it needs. Avoid slicing by technical layer, such as “migrate the database first”, because that delivers nothing a user can see.
  3. Build the replacement and run it in shadow. Send a copy of production traffic to the new component, discard its responses and compare them with the legacy output. Differences are either bugs or undocumented rules.
  4. Shift traffic gradually. Use feature flags or weighted routing: internal users, then 1 percent, 10 percent, 50 percent, all. Keep the legacy path warm until the new one has survived a full business cycle, including month-end if the domain has one.
  5. Retire the old code path. Deleting code is part of the work. A strangler that never removes anything just adds a second system.

When the pattern does not fit

Strangling works best for request-response systems with identifiable seams. It is awkward for batch-heavy platforms where jobs share state through a database, and for tightly coupled UI-plus-logic desktop applications. In those cases consider alternatives: wrapping the legacy core behind an anti-corruption layer and leaving it in place, replatforming (lift and shift with minimal change) to buy time, or replacing the whole system with a commercial product when the domain is a commodity such as payroll or general ledger.

Approach Best when Main risk Typical time to first value
Strangler fig Clear seams, active development needed Long coexistence of two systems 2 to 4 months
Big-bang rewrite Small system, full test coverage, hard stop date Scope creep, delayed cutover 12 to 24 months
Replatform (lift and shift) Hardware or hosting end-of-life Carries technical debt forward 1 to 3 months
Wrap with anti-corruption layer Stable core, new features needed around it Core remains a bottleneck 1 to 3 months
Buy and configure Commodity domain Customisation limits, vendor lock-in 3 to 9 months

These ranges are illustrative; your own numbers will depend on team size and system complexity.

Data migration is the hard part

Code can be rewritten; data carries history, errors and obligations. Treat data migration as a product in its own right, with an owner and a timeline.

Decide who owns the data during coexistence

For each entity, exactly one system should be the source of truth at any time. Two systems writing to the same record leads to conflicts that are painful to reconcile. Common ways to handle the transition:

  • Move ownership in one step per entity. Customers are owned by legacy until a defined switch, then by the new service. Legacy receives updates through an adapter if it still needs them.
  • Change data capture (CDC). Stream changes from the legacy database using log-based tools such as Debezium, so the new system stays in sync without modifying legacy code.
  • Dual writes with reconciliation. Tempting but fragile. If you use them, run an automated reconciliation job that compares both stores and alerts on drift.

Clean at the border, not in place

Data quality problems such as duplicate customers, inconsistent country codes and free-text fields used as foreign keys are best fixed in the migration pipeline, with rules documented and reviewed by the business. Keep the raw extract so that you can always show what the old value was and why it changed. In regulated sectors, this lineage is often a requirement, not a nicety.

Rehearse the cutover

Run the full migration against a production-sized copy several times. Measure duration, error counts and record-level reconciliation: row counts, financial totals and checksums per entity. A rehearsal that takes nine hours when the maintenance window is four is a finding, not a failure, as long as you learn it early. Also decide in advance what triggers a rollback and what rolling back means once new writes have occurred.

Managing risk

Modernisation risk is mostly about surprises, so the tactics are about making surprises small and cheap.

  • Keep slices small. If a slice cannot ship in one to two months, split it. Small releases mean small rollbacks.
  • Automate the safety net. Contract tests between the facade and both backends, synthetic transactions against production, and dashboards that compare error rates and latency of old and new paths side by side.
  • Protect the freeze. You will need some feature work on the legacy system during the programme. Agree on a policy, for example that new features are built in the new component whenever the capability has already moved, and that legacy changes require a note on how they will be carried over.
  • Plan for people. Legacy knowledge lives in a few heads. Pair those people with the new team early, record walkthroughs of the strange parts, and recognise their contribution; they are the best source of real requirements.
  • Budget for security. Every new integration point is a new attack surface. Review authentication between facade and services, and avoid leaving unauthenticated internal endpoints because “it is only temporary”.

Sequencing the work

A defensible order looks like this:

  1. Foundations. Source control, CI/CD, observability and the facade. These pay off for every later slice.
  2. A low-risk pilot slice. Choose something visible but not critical, such as a read-only report, a notification service or an internal admin screen. The aim is to prove the pipeline and the team, not to maximise business impact.
  3. High-change capabilities. Move the parts where the delivery-speed pain is greatest, so the benefit shows up in the roadmap.
  4. High-risk core. Leave transactional heart-of-the-system capabilities until the team has a track record, tooling and a reconciliation habit.
  5. Decommissioning. Archive data according to retention rules, switch off infrastructure, revoke credentials and update disaster-recovery plans.

Resist ordering purely by technical neatness. A dependency graph may suggest starting at the leaves, but a visible early win funds patience for the harder middle.

Measuring progress honestly

Percentage of code rewritten is a poor metric: it rewards the easy parts first and says nothing about value. Better indicators come in three groups.

Migration progress

  • Share of production traffic served by new components, by capability and by revenue weight.
  • Number of legacy interfaces and database tables still in use, trending down.
  • Lines or modules deleted from the legacy codebase, a direct sign that strangling is really happening.

Delivery health

  • The four DORA metrics: deployment frequency, lead time for changes, change failure rate and time to restore service. Compare legacy and new components separately.
  • Time to onboard a new engineer to productive contribution.

Business and cost outcomes

  • Incidents and manual interventions per month in migrated capabilities.
  • Run cost per transaction, including licences and hosting.
  • Cycle time for the specific business changes that motivated the project.

Publish these in a simple monthly review with the sponsors. If traffic share is flat for three months while spending continues, that is the signal to stop and diagnose, rather than to push harder.

Common mistakes to avoid

  • Rebuilding bugs as features. Not every legacy behaviour deserves to be carried over; use characterisation tests to surface the question, then decide deliberately.
  • Ignoring non-functional behaviour. The old system may be fast at one thing, such as bulk exports, in ways nobody documented. Measure latency and throughput before replacing.
  • Under-investing in the facade. If routing is hand-edited config that only one person understands, you have recreated the original problem.
  • Declaring victory early. The programme is finished when the legacy system is turned off, not when the new one launches.

Key takeaways

  • Define the business pain first; it decides whether you replace, wrap, replatform or leave a component alone.
  • Use a facade and thin vertical slices so every release is small, visible and reversible.
  • Treat data migration as its own workstream with a single owner of truth per entity, rehearsed cutovers and reconciliation checks.
  • Capture existing behaviour with characterisation tests and shadow traffic before trusting a replacement.
  • Measure traffic share, deleted legacy code and DORA metrics rather than percent of code rewritten.
  • Plan decommissioning from day one, or you will end up running two systems indefinitely.
#legacy modernization#strangler fig#data migration#software architecture
DI
Datainter TeamEngineers, designers and operators building software and fintech products from Medellín, Tigard and Luxembourg.

Building something in this space?

Talk to the team that ships and operates it. We reply within one business day.

Start a project
Chat with us on WhatsAppUSUALLY REPLIES WITHIN MINUTES