Anticorruption layer
An anticorruption layer is an integration boundary that translates between an external system’s model and an internal domain model, insulating the latter from unwanted external concepts and coupling.
Learn Go with Pocket-Sized Projects
An anti-corruption layer is an integration boundary that translates an external model into a domain's internal model while preventing unwanted coupling.
- How it is used
- Isolates an HTTP server from gRPC backend structures while simplifying calls and supplying internal habit data.
- How deep it goes
- Works through a client wrapper, model conversion and mocked tests, with some listing details abbreviated.
- Examples
- Uses a habits server whose client retrieves habits and weekly tick counts for an HTML server.
- What you can do after
- Build it from scratch as a Go client wrapper and test its conversion and backend error paths with mocks.
Read how Learn Go with Pocket-Sized Projects explains anticorruption layer →
Architecture Modernization: Socio-technical alignment of software, strategy, and structure
An anticorruption layer is an integration boundary that translates between a new model and an external or legacy model to prevent the latter's concepts from contaminating the former.
- How it is used
- Protects a fresh domain model during gradual migration while new functionality still interacts with legacy subsystems.
- How deep it goes
- Defines model translation and works through domain-event integration and migration trade-offs, without specifying translation code.
- Examples
- Uses a gigs platform where an ACL turns a Job Published domain event into a job in the legacy model.
- What you can do after
- Evaluate/understand it as a migration boundary by weighing model independence against the complexity of translation.
Grokking Software Architecture
A boundary pattern that translates between an external system's model and an application's domain model to prevent external concepts from affecting the domain model.
- How it is used
- Protects the application core from external models and filters data at integration boundaries.
- How deep it goes
- Defines adapter translation and gives security guidance on masking and filtering, without a detailed layer implementation.
- Examples
- Uses an order controller, a SQL repository, and an API exposing a complete user object to illustrate boundaries.
- What you can do after
- Evaluate integration boundaries for external-model leakage and unnecessary data exposure.
Read how Grokking Software Architecture explains anticorruption layer →
Clean Applications with Hexagonal Architecture
A translation boundary that protects a domain model from the concepts and representations of an external system.
- How it is used
- Protects a consuming domain from a neighbor’s model during cross-context interactions.
- How deep it goes
- Explains adapter placement, response and failure mapping, and stops short of assigning business rules to the layer.
- Examples
- Uses WriteFlow author validation and a partner CMS reopening an article for review.
- What you can do after
- Apply the boundary by translating a neighbor’s response and failures before they reach a use case.
Read how Clean Applications with Hexagonal Architecture explains anticorruption layer →
Unit Testing Principles, Practices, and Patterns
An architectural boundary that isolates a domain model from the concepts and interfaces of an external system or model.
- How it is used
- Isolates application code from third-party libraries so tests mock project-owned adapters rather than external interfaces.
- How deep it goes
- Defines adapters that hide library complexity, expose needed features in domain language, and limit upgrade ripple effects to one class.
- Examples
- Uses an IBus wrapper around a message-bus library and verifies an email-change message through the project-owned interface.
- What you can do after
- Apply it by wrapping an external library, exposing needed domain operations, and mocking the wrapper in tests.
Read how Unit Testing Principles, Practices, and Patterns explains anticorruption layer →
Also covered in
What to know first
- domain modelA domain model is a software representation of the concepts, entities, relationships, rules, and behavior of a problem domain.
- mockingMocking is a testing technique that replaces a dependency or collaborator with a controlled substitute to simulate behavior, isolate code, or inspect interactions.
Related concepts
- adapterkind of · An adapter is a software component that translates between interfaces or representations so otherwise incompatible components can work together.
- driving adaptercontrasts with · A driving adapter receives input from an external actor or system, translates it into application terms, and invokes an application input port.
- bubble patternused by · The bubble pattern is a migration pattern in which a new subsystem with a fresh domain model is placed in front of an existing subsystem and gradually takes over its logic.
- domainaddresses · A domain is an area of subject matter, activity, or problem context whose concepts, rules, and requirements a software system models or addresses.
- eventuses · A software event is an occurrence, state change, or notification that a system can detect, record, communicate, or handle.
Questions about anticorruption layer
What is anticorruption layer?
An anticorruption layer is an integration boundary that translates between an external system’s model and an internal domain model, insulating the latter from unwanted external concepts and coupling.
Which Manning books explain anticorruption layer?
Learn Go with Pocket-Sized Projects, Architecture Modernization: Socio-technical alignment of software, strategy, and structure, Grokking Software Architecture, Clean Applications with Hexagonal Architecture and Unit Testing Principles, Practices, and Patterns.
What should I know before learning anticorruption layer?
Manning books that teach anticorruption layer usually introduce domain model and mocking first.
What is the difference between anticorruption layer and driving adapter?
An anticorruption layer is an integration boundary that translates between an external system’s model and an internal domain model, insulating the latter from unwanted external concepts and coupling. A driving adapter receives input from an external actor or system, translates it into application terms, and invokes an application input port.
What is anticorruption layer a kind of?
Anticorruption layer is a kind of adapter. An adapter is a software component that translates between interfaces or representations so otherwise incompatible components can work together.
What is anticorruption layer also called?
Anticorruption layer is also called anti-corruption layer.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.




