Home/Labs/Anti-Corruption Layer Lab
All 280 Labs
INTERACTIVE LAB🧱

Anti-Corruption Layer Lab (Interactive)

Feed mainframe codes like 51_NSF to your checkout service with and without an ACL, then price the migration debt. Fire charges at a COBOL core-banking system and watch the ACL map cryptic responses to domain enums, while direct coupling leaks legacy fields into every caller.

Anti-Corruption Layer Lab

A 35-year-old COBOL core-banking system answers with cryptic codes. Choose whether they reach your clean Go checkout service.

Trigger a charge — mainframe replies with:

Domain purity

100%

Leaked fields

0

Swap cost now

5 d

checkout → paymentService.chargeCustomer(cust_8841, {amountCents: 4999, currency: 'USD'})

ACL adapter → SOAP: { CUST_IDENT_NUM_9: "8841", TXN_VAL_AMT: "49.99", CURR_CD_ISO: "840", TERMINAL_OP_ID: "WEB_ONLINE_NODE_01" }

checkout receives: PaymentStatus.AUTHORIZED / DECLINED / ERROR — enum is closed

Fire a charge to see how the response travels.

The ACL is the only place that knows EBCDIC exists. ISO-4217 numeric currency codes, RC_9918 queue errors, and CUST_REC_TYP_9 stay behind the translation boundary — the Strangler Fig can grow because the new side never inherits the old side’s vocabulary.

How It Works Under the Hood

Modern services integrated straight against legacy APIs absorb the legacy vocabulary: CUST_IDENT_NUM_9, EBCDIC conversions, and response codes like 00_APPROVE or 77_PENDING_X spread through domain models, switches, and database columns. Eric Evans's Anti-Corruption Layer is a translation boundary — facade, adapters, legacy client — that exposes only the new bounded context's ubiquitous language and confines every legacy quirk behind it. The payoff is strategic: when the mainframe is decommissioned under a strangler fig plan, only the ACL implementation changes and zero calling services are rewritten.

Core Architectural Principles

  • Response-code buttons run each scenario through status mapping or leak raw strings into the domain model.
  • Leaked-field counters and domain purity score quantify contamination of directly coupled callers.
  • The decommission action prices the swap: adapter-only rework versus per-caller rewrite of every coupled service.
Interview Round Script

In any legacy-integration question, name the ACL and its three parts: facade, translator, legacy client invoker. Give the concrete mapping — '51_NSF' to a DECLINED enum, RC_9918 to a domain exception — then make the strategic argument: the ACL is what makes strangler-fig swaps cheap, because calling services never learned the old language.

Key Trade-Offs

Domain purity and cheap legacy swaps versus one more translation layer to build, deploy, and keep synchronized.

Related Curriculum Chapter

The Anti-Corruption Layer (ACL) Pattern

Read Full Chapter Blueprint

Explore More Interactive Labs

View All 280 Labs