Anti-corruption layer
An anti-corruption layer is the translation boundary between two bounded contexts that prevents the model of one from leaking into the other. The ACL converts incoming external concepts into the consuming context's domain model and outgoing internal concepts into the format the external context expects, keeping each context's domain pure.
ACL is a classic DDD pattern most useful at integration boundaries — between your fresh domain model and a legacy system you must integrate with, or between two teams whose models have evolved independently. Without an ACL, the foreign model leaks: external field names appear in internal classes, external assumptions creep into business logic, and a change in the external system breaks code throughout your codebase. With an ACL, the foreign model is contained at the boundary; internal code speaks only the internal model. The cost is a layer of translation code that can feel duplicative until the first time the external system changes and the ACL absorbs the change cleanly.
Related terms
- Bounded context
A bounded context is the boundary within which a particular domain model — its terms, rules, and invariants — is consistent and authoritative.
- Domain-driven design
Domain-driven design (DDD) is a software-design approach, formalised by Eric Evans in 2003, that places the business domain at the centre of model design.
- Hexagonal architecture
Hexagonal architecture (also called ports and adapters), introduced by Alistair Cockburn in 2005, structures an application so the core domain logic depends only on abstract 'ports' — and concrete adapters (web framework, database, message bus) plug into those ports from outside.