Skip to content

Instantly share code, notes, and snippets.

@sistemd
Last active December 7, 2022 13:04
Show Gist options
  • Save sistemd/0f68a4e0c33df80f9d415b20f9848bcf to your computer and use it in GitHub Desktop.
Save sistemd/0f68a4e0c33df80f9d415b20f9848bcf to your computer and use it in GitHub Desktop.

Anti-corruption layer

When a new system is being built that must have a large interface with another, the difficulty of relating the two models can eventually overwhelm the intent of the new model altogether, causing it to be modified to resemble the other system’s model, in an ad hoc fashion. The models of legacy systems are usually weak, and even the exception that is well developed may not fit the needs of the current project. Yet there may be a lot of value in the integration, and sometimes it is an absolute requirement.

Therefore, the developer should create an isolating layer to provide clients with functionality in terms of their own domain model. The layer talks to the other system through its existing interface, requiring little or no modification to the other system. Internally, the layer translates in both directions as necessary between the two models.

— Eric Evans, Domain-Driven Design: Tackling Complexity in the Heart of Software (2014)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment