Anti-corruption layer (ACL)
A translation layer between your model and a legacy or external system, so its data shapes and quirks do not leak into your code.
An old ERP may call a customer by a cryptic code with seven status values; your code should not. The layer converts its requests and responses into your terms in one place, hides retries and odd error codes, and is the only code that changes when the other system does. It pairs with the strangler fig pattern when replacing a legacy system piece by piece.
Related terms
- Strangler fig pattern: Replacing a legacy system piece by piece, routing one feature at a time to new code until the old system can be switched off.
- DDD (domain-driven design): Designing software around the business’s own language and rules, with the code split where that language changes meaning.
- BFF (backend for frontend): A small backend built for one client, such as the web app or the mobile app, that shapes data exactly the way that client needs it.
- Conformist (DDD): A downstream team adopts the upstream system’s model as it is, without translating it, because it cannot influence it and translation is not worth it.
- Context map (DDD): A diagram of the bounded contexts in a system and the kind of relationship between each pair: who depends on whom and how models are translated.
- Dual-write problem: Writing one change to two systems, such as a database and a broker or an old and a new store, without a shared transaction, so they can drift apart.
