liveBook · Manning

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.

How 3 Manning books explain it

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.

Read how Architecture Modernization: Socio-technical alignment of software, strategy, and structure 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 →

Related concepts

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.