16 Nov 2023
Anti-Corruption Layer (ACL) in Domain-Driven Design (DDD) is a layer of abstraction that sits between the domain model and external systems. It is responsible for translating between the domain model and the foreign data models and APIs of those external systems. The goal of the ACL is to protect the domain model from being corrupted by the foreign concepts and models of the external systems.
ACLs are typically used in cases where a domain needs to interact with an external system that is outside of its control, such as a legacy system, a third-party API, or a database. By using an ACL, the domain model can be isolated from these external systems, making it more resilient to change and easier to maintain.
Here are some specific examples:
- Online banking application: The anti-corruption layer could be used to translate between the bank's internal data model and the external data models of the various third-party services that the bank integrates with, such as credit scoring services, fraud detection services, and payment processing services.
- E-commerce platform: The anti-corruption layer could be used to translate between the platform's internal data model and the data models of the various third-party services that the platform integrates with, such as shipping carriers, payment processors, and product catalogs.
- Enterprise resource planning (ERP) system: The anti-corruption layer could be used to translate between the ERP system's internal data model and the data models of the various other systems that the ERP system integrates with, such as customer relationship management (CRM) systems, manufacturing execution systems (MES), and supply chain management (SCM) systems.