
Gerson Sunyé gerson.sunye@univ-nantes.fr
Focuses on the high-level design of the system
Involves:
understanding the business domain
defining bounded contexts
mapping the relationships between them
Key Concepts:
Bounded Contexts
Context Mapping


Aligns software with business goals.
Reduces complexity by separating concerns.
Enhances communication across teams.


One of the most important concepts of DDD
Mainly a linguistic delimitation
Each Bounded context has its own Ubiquitous Language

Modeled within a Bounded context
Identifies terms and concepts of the business domain
Brings together the domain experts and the technical team

Help in understanding the whole project:
show the relationships between the different Bounded Contexts
To build the domain model correctly, it is important to understand these relationships
Open Host Service and Event Publisher
Shared Kernel, Published Language, Separate Ways, Partnership
Customer/Supplier, Conformist, Anti-Corruption Layer

defines a protocol that gives access to the sub-system as a set of services.
publishes all its domain events through an asynchronous messaging system

designates a subset of the domain model that the two teams agree to share.
common language that translates models from different contexts

the two sets of functionality have no significant relationship
the two contexts forge a partnership to avoid that failures in one side impact the other

relationship where the upstream team may succeed interdependently of the downstream team
relationship where the upstream has no motivation to provide for the downstream needs
more defensive map, which prevents the intrusion of foreign terms.

Set of defensive patterns between:
Two bounded contexts
Our domain model and third-party dependencies
Intent: prevent the intrusion of foreign concepts
Preserves the integrity of the domain model
Encapsulates technological and technical details
Promotes loose coupling
Use a anti-corruption layer to isolate différent subsystems
This layer translates the communication between systems
each subsystem remains the same
the design is not corrupted
The Domain Model activates and sends a request to the Anti-Corruption Layer (ACL).
The ACL activates and uses an Adapter to translate the domain request into the format and semantics of the External System.
The Adapter activates and communicates with the External System to send the translated request.
The External System activates and processes the request, then sends back a response to the adapter.
The Adapter activates and translates the response into the format and semantics of the domain model.
The Adapter de-activates and the ACL activates, then provides the translated data to the Domain Model.
The ACL de-activates and the Domain Model activates, receiving the translated data.
By isolating the domain model from external systems, the ACL makes it easier to maintain the domain model and adapt it to changes in the external environment.
The ACL allows you to test the domain model in isolation from external dependencies, making it easier to ensure its correctness.
The ACL helps to reduce the complexity of the overall system by encapsulating the interaction with external systems.
An ACL may impact response times. The additional processing introduced by the ACL can add latency to calls between the domain model and the external systems. This impact needs to be assessed and mitigated if necessary.
| Consider how the ACL will scale under increased load. Ensure it can handle the expected amount of traffic without bottlenecks. |
Implementing and maintaining an ACL adds complexity to the system. It requires additional code, testing, and documentation.
| Be mindful not to over-engineer the ACL by adding unnecessary layers or complexity. Keep it focused on its core purpose of isolating and protecting the domain model. |
The ACL should be flexible enough to adapt to changes in the external systems without requiring significant modifications to the domain model.
| The ACL should not prevent the evolution of the domain model. It should be designed to accommodate changes in domain logic and concepts. |
Implement robust error handling mechanisms within the ACL to gracefully handle failures and exceptions.
| Establish adequate logging and tracing capabilities to monitor the performance and behavior of the ACL and identify potential issues. |
Design the ACL with testability in mind. This allows you to mock or stub external dependencies during testing to isolate and test specific components of the ACL.
| In addition to unit and integration tests, consider implementing end-to-end tests that validate the interaction between the domain model, the ACL, and the external systems. |
Implement data validation and sanitization mechanisms within the ACL to protect the domain model from invalid or malicious data coming from the external systems.
| Implement appropriate authorization and access control mechanisms within the ACL to control how the domain model interacts with the external systems. |
Clearly document the purpose, design, and implementation of the ACL. This documentation will help developers understand how the ACL works and how to interact with it.
| Clearly define the contracts and boundaries between the domain model, the ACL, and the external systems. This will help ensure consistency and maintainability. |

corresponds to bounded contexts that have no connection to others.
is indicative of a domain that is not modularized.

uses a well-documented and shared language that can express the necessary domain information as a common medium of communication, translating as required
eliminates the complexity of translation between bounded contexts by slavishly adhering to the model of the upstream team

creates an isolating layer to provide clients with functionality in terms of their own domain model; the layer ks to the::other system through its existing interface, requiring little or no modification to the other system
defines a protocol that gives access to your sub-system as a set of services

communicates with other bounded contexts through domain events that can be consumed by other bounded contexts
establishes a clear customer/supplier relationship between the two teams

designates some subset of the domain model that the two teams agree to share