Anti-Corruption Layer
An Anti-Corruption Layer (ACL) is an architectural pattern, originating from Domain-Driven Design, that introduces a translation layer between two systems or bounded contexts with different data models or semantics, preventing the…
Definition
An Anti-Corruption Layer (ACL) is an architectural pattern, originating from Domain-Driven Design, that introduces a translation layer between two systems or bounded contexts with different data models or semantics, preventing the concepts, assumptions, or 'corruption' of one system's model from leaking into and polluting another.
Overview
The Anti-Corruption Layer pattern comes from Eric Evans' Domain-Driven Design (DDD), where a 'bounded context' represents a boundary within which a particular domain model and its terminology are consistent and well-defined. When two bounded contexts need to interact — for instance, a modern service integrating with a legacy system, or two systems acquired through a merger with incompatible data models — directly coupling one system's internal model to the other's risks 'corrupting' the cleaner or newer model with the older or foreign system's assumptions, naming conventions, and structural quirks. An Anti-Corruption Layer addresses this by introducing an explicit translation boundary: a set of adapters, facades, or translator components that sit between the two systems, converting requests and data from one system's model into the other's model and back again. Code on the 'clean' side of the ACL only ever interacts with its own well-designed domain model; all the messiness of translating to and from the external or legacy system's model is contained within the ACL itself, isolated from the rest of the application. This pattern is especially valuable during Strangler Fig-style incremental migrations, where a new system must communicate with a legacy system for an extended transition period. Without an ACL, the new system's codebase risks gradually absorbing legacy naming conventions, data quirks, and business rule assumptions simply through repeated direct interaction, undermining the very reason the new system was being built. The ACL contains that risk to a bounded, well-understood translation layer, which can be more easily modified or eventually removed once the legacy system is fully decommissioned. Anti-Corruption Layers are also common in integrations with third-party vendors or external partner APIs, where the external system's data model is outside the integrating team's control and likely to differ in structure, terminology, or business rules from the internal domain model, making direct coupling risky and brittle to external changes.
Key Concepts
- Introduces a translation boundary between two systems with differing domain models
- Originates from Eric Evans' Domain-Driven Design and the concept of bounded contexts
- Prevents a foreign or legacy system's model from leaking into a clean domain model
- Implemented via adapters, facades, or dedicated translator components
- Frequently used alongside the Strangler Fig pattern during incremental migrations
- Common in integrations with third-party vendors or external partner systems
- Isolates translation complexity to a bounded, replaceable layer
- Can be removed once the legacy or external dependency is no longer needed
Use Cases
Frequently Asked Questions
From the Blog
Vector Databases Explained: The Memory Layer Powering AI Apps
Vector databases are the storage layer behind RAG systems, semantic search, and AI- powered recommendations. This guide explains what they are, how they differ from traditional databases, and how to choose and use one in a real application.
Read More ProgrammingWhat Is an Operating System? Core Concepts Explained
An operating system is the software layer that manages a computer's hardware and runs other programs on top of it, handling memory, processes, and files so applications don't have to. Here's how it works and why every device needs one.
Read More Cloud & CybersecurityThe Network Layer Explained: How Data Finds Its Way
The network layer is the part of a computer network that decides how data packets travel from a source to a destination across interconnected networks. This guide explains its job, the protocols it relies on, and why routing and addressing sit at its core.
Read More ProgrammingWhat Is JavaScript Used For? A Practical Overview
JavaScript is used to make web pages interactive, build entire web and mobile applications, run servers, and increasingly power tooling across nearly every layer of modern software development, well beyond its browser origins.
Read More