Anticorruption layer
An integration boundary that translates between an external system’s model and an internal domain model while isolating the internal model 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 a backend gRPC model while an HTTP server obtains domain data for HTML responses.
- How deep it goes
- Works through package separation, client wrapping, response conversion, dependency injection, and mock-based error tests.
- Examples
- Uses a habits service whose client lists habits and requests each habit’s status before returning internal values.
- What you can do after
- Build it from scratch by wrapping a generated gRPC client, returning domain values, and testing the wrapper with a mock.
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.
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 →
Related concepts
- 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.
- adapterincludes · The adapter pattern is a structural design pattern in which a component translates between interfaces or representations so otherwise incompatible components can work together.
- eventuses · An event is an occurrence, change, or associated record or notification recognized as significant within a system or context.
- raw typehas part · A raw type is a Java generic type used without specifying its type arguments, weakening compile-time type checking for that use.
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.


