Scrivio Interview library
ScenarioAdvanced7 min read · updated 12 November 2026

During a strangler fig migration from a legacy system to new services, where do you place anti-corruption layers, and how do you avoid them becoming permanent?

In a strangler fig migration, we place an anti-corruption layer between each new service and the legacy system, so the new model stays clean while it still needs legacy data or behaviour, and sometimes it must translate both ways while both systems share data. To stop it becoming permanent, we plan its retirement together with the legacy functionality it wraps, give it a named owner, track which flows still pass through it, and monitor its usage so we know when it can be removed. Without such a plan, the ACL stays forever and its translations slowly drift from both sides.

Why this question is asked

The strangler fig pattern is the standard way to replace a legacy system without a big-bang rewrite: new services take over one capability at a time while the old system keeps running the rest, until nothing is left of it. Anti-corruption layers are what keep the new services from inheriting the old system's model during that long overlap. Interviewers ask this scenario because many migrations end with the new services finished and the old system and its translation layers still running years later. In this answer, we will recap the strangler fig, see where ACLs go, handle two-way translation, and then focus on what keeps them temporary: retirement planning, ownership, tracking and monitoring.

1A Quick Recap of the Strangler Fig Pattern

The strangler fig is named after a plant that grows around a host tree until it replaces it. In software, we put a routing layer, such as an API gateway or a facade, in front of the legacy system. We build a new service for one capability, say customer accounts, and route those requests to it. The rest still goes to the legacy system. Step by step, more capabilities move, until the legacy system receives no traffic and can be switched off.

During the migration, which often lasts years, new and old must cooperate. A new Accounts service may need order history that still lives in the legacy database, and the legacy billing module may still need account data that is now owned by the new service.

2Where the Anti-Corruption Layers Go

An anti-corruption layer, ACL, translates between two models so that one does not leak into the other. In a strangler migration, the main placement is between each new service and the legacy system. When the new Accounts service needs legacy order history, it calls an interface in its own terms, and the ACL behind it reads the legacy API or tables and translates the cryptic legacy structures into the new model.

The reason to put it there, rather than letting new services read legacy tables directly, is that the new services are meant to outlive the legacy system. If their code is full of legacy column names and codes, the migration has simply copied the old model into new code, and replacing the legacy system later still forces changes everywhere.

Step throughA strangler fig migration with anti-corruption layers
  1. Routing facade or API gatewaysends migrated capabilities to new services
  2. New servicesclean models: Accounts, Orders
  3. Anti-corruption layersone per legacy dependency, translate both ways if needed
  4. Legacy systemstill runs the capabilities not yet migrated
  5. Legacy databaseshared data during the overlap

5 layers, from the top down. Step through them one at a time.

3When the Layer Must Translate Both Ways

For a while, both systems often need the same data. Suppose accounts are now created in the new service, but the legacy billing module, not yet migrated, still reads the legacy customer table. Then the ACL works in both directions: it translates legacy data into the new model for reads, and it writes new accounts back into the legacy format, by calling a legacy API or writing the legacy tables, so billing keeps working.

Step throughTwo-way translation during the overlap
New Accounts serviceACLLegacy system
AccountOpened(accountId, legalName, country)
insert CUSTMAST row: CUST_NO, NAME_1, CTRY_CD
legacy order history for CUST_NO
OrderHistory in the new model

4 messages in order. Play them, or step through them one at a time.

The ACL keeps legacy billing working while the new service owns accounts.

Two-way translation is the most fragile part of the migration, because every rule exists twice, once in each direction, and the two systems may disagree about which one is the source of truth. So we make ownership explicit per piece of data and per period: during this phase, accounts are owned by the new service and copied to legacy, never the other way round. Writing that down avoids the worst failure, two systems both believing they own the same record.

4Plan Retirement Together With the Legacy Functionality

An ACL that wraps legacy functionality exists only because that functionality exists. So its retirement belongs in the same plan. When we schedule 'migrate billing off the legacy system in Q3', the plan must also say 'remove the account write-back from the Accounts ACL in Q3', because once billing no longer reads the legacy customer table, nobody needs it. Each ACL gets a list of the flows it supports, and each flow is tied to the legacy capability that requires it and that capability's migration date.

This makes the end visible from the start. Instead of a permanent piece of infrastructure, the ACL is scaffolding with a known removal date for each of its parts.

5Ownership, Tracking and Monitoring

Every ACL needs a named owner, usually the team of the new service it protects. Without an owner, translation bugs are nobody's problem and removal is nobody's job. The owner keeps a list of the flows still passing through it, for example 'order history read for Accounts' and 'account write-back for billing', with the legacy capability each depends on.

Monitoring makes the list honest. We instrument each flow through the ACL with a counter or metric, such as calls per day by flow, and put them on a dashboard next to the migration plan. When a flow reaches zero calls for a few weeks after its legacy consumer moved, we remove its code. When the whole ACL reaches zero, we delete it. Usage data also shows flows nobody knew about, which would otherwise block retirement at the last minute.

Java
// Count every flow through the ACL so we can see when it is unused
public OrderHistory history(AccountId id) {
meterRegistry.counter("acl.legacy.calls", "flow", "order-history-read").increment();
return translator.toHistory(legacyClient.fetchOrders(accountMapping.legacyNo(id)));
}
// Dashboard: acl.legacy.calls{flow="order-history-read"} = 14,200/day
// acl.legacy.calls{flow="account-write-back"} = 0/day for 30 days -> remove it

6What Happens Without a Plan

Without retirement planning, ACLs become permanent. The migration slows down after the exciting capabilities move, the last legacy modules keep running, and the translation layer stays because something might still use it. Over time it drifts from both sides: the new model evolves and the ACL's mapping is updated only partly, while the legacy side changes through patches nobody tells the new team about. The layer then becomes a source of subtle data bugs, owned by nobody and feared by everyone. A clear owner, a list of flows tied to migration dates, and usage metrics turn that risk into an ordinary, tracked piece of work.

7Follow-up questions

Should the ACL live in the new service or in a separate component?

Usually in the new service, as its integration module, because it protects that service's model and is owned by its team. A shared ACL used by several new services is sometimes justified when they all need the same legacy data, but it needs its own owner and a stricter plan, since shared components are harder to retire.

Can change data capture replace the two-way ACL?

CDC can move legacy changes into new services as events, which is a good replacement for polling legacy tables. It still needs translation from legacy structures to the new model, so it is one way to build the ACL, not a reason to skip it.

How do you decide the order of migration?

Often by dependencies and value: capabilities with few legacy dependencies or high business value move first. Looking at the ACL flows each capability would need helps, because a capability that needs many two-way flows will be expensive to migrate early.

8Conclusion

In this answer, we placed anti-corruption layers between new services and the legacy system during a strangler fig migration, so the new models stay clean, and saw that they sometimes must translate both ways while legacy and new systems share data. To keep them temporary, we plan each ACL's retirement together with the legacy functionality it wraps, assign an owner, track which flows still pass through it and monitor their usage. Without a plan, the ACL becomes permanent and its translations drift from both sides.

What to say in the interviewAbout 100 seconds aloud

Open with

In a strangler fig migration I put an anti-corruption layer between each new service and the legacy system. The new services are meant to outlive the legacy system, so I do not want legacy table names, codes and quirks in their code.

Then, if they want more

When the new Accounts service needs order history that still lives in legacy, it calls an interface in its own terms, and the ACL behind it reads the legacy system and translates. During the overlap, the layer sometimes has to translate both ways.

If accounts are now created in the new service but legacy billing still reads the old customer table, the ACL writes new accounts back in the legacy format. That is the fragile part, so I make ownership of each piece of data explicit for each phase, so two systems never both think they own a record.

To stop the ACL becoming permanent, I treat it as scaffolding. Each flow through it is tied to the legacy capability that needs it, and its removal is in the same plan as that capability's migration: when billing moves off legacy, the write-back flow goes too.

The ACL has a named owner, usually the new service's team, who keeps the list of flows, and every flow is instrumented with a metric. When a flow shows zero calls for a few weeks after its consumer moved, we delete it, and when everything is at zero, we delete the layer.

Without that, the ACL stays forever, drifts from both sides and becomes a source of subtle data bugs nobody owns.

About this answer

Last updated
12 November 2026
Checked
Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the official documentation for the version you use. What the checks cover
Where the question comes from
Written by Scrivio for practice. It is not taken from an interview.
Report an issue with this answer

Copy the line below and send it to the author with what you found. It carries the address of this page.

Issue with "During a strangler fig migration from a legacy system to new services, where do you...": https://scrivio-interview-library.netlify.app/java/domain-driven-design/088ebb608f/