Bounded Context

In domain-driven design (DDD), a bounded context is a boundary that defines the scope within which a certain model applies. It’s used to isolate different models and avoid confusion. The idea behind bounded context is to create different models for different aspects of the domain and to clearly define the boundaries between them, so that the same terms can be used with different meanings in different contexts.

For example, a customer can have different meanings depending on the context: in a billing context, it’s a person who owes money; in a shipping context, it’s a person who receives goods. By creating a separate model for each context, you can avoid confusion and make the code more explicit.

Bounded context is used to create a context map, which shows the relationships between different models and how they interact with each other. It also helps to identify the areas of the domain where different models are needed, and to define the boundaries between them.

Bounded context also helps to improve communication and collaboration between developers, stakeholders, and domain experts by providing a common language and a shared understanding of the domain. It also promotes modularity, maintainability, and adaptability of the code.

When creating a bounded context, it’s important to identify the context within which the model applies, to define the boundaries of the context, to create a model that is consistent with the overall domain model, and to communicate the context to the other contexts and the overall domain.