What is an Anticorruption Layer?

Pedro Augusto - Nov 9 - - Dev Community

I set a goal to learn something new every day, at least one thing. And I will try to share it here.
My goal here is to present what I’ve learned more simply as if I were explaining it briefly to someone unfamiliar with the topic.
One of the concepts I recently encountered is the Anti-Corruption Layer.
The Anti-Corruption Layer is a design pattern in software development. It facilitates communication between subsystems that are incompatible.
To explain: Subsystem A, when communicating with another subsystem B, uses this layer as an intermediary.
The communication between A and the Layer follows the data model and architecture of that subsystem.
In turn, the communication between the Layer and subsystem B follows the data model and architecture of B.
It’s important to mention that this type of pattern is used when there are SEMANTIC differences between the subsystems.
So, for example, the Anti-Corruption Layer can act by adapting the name of a field that is in snake case (e.g., snake_case) in the first subsystem and translating it to camel case (e.g., camelCase) to be used in the other subsystem.
This way, potential software breakdowns due to corruption are prevented.

For a deeper read: https://learn.microsoft.com/pt-br/azure/architecture/patterns/anti-corruption-layer

. .