top of page

What is an Context Map?

In Domain-Driven Design (DDD), a Context Map is a tool used to visualize and define the relationships between different bounded contexts within a system. It helps to identify how different parts of a system interact, collaborate, or are isolated from one another. Here's a detailed explanation of a Context Map in DDD:


Key Concepts:


1. Bounded Context:

   - A Bounded Context represents a logical boundary where a particular model is defined and applied. It is the scope within which a domain model is valid and consistent.

   - In large systems, multiple bounded contexts exist, each representing a specific subdomain or area of the business. These bounded contexts can have their own language (ubiquitous language), rules, and data structures.


2. Context Map:

   - A Context Map shows how different bounded contexts in a system are related and interact with one another.

   - It captures the integration patterns between bounded contexts and how they communicate.

   - It provides a high-level view of the entire system, helping teams manage complexity by making the relationships and dependencies between bounded contexts explicit.


Common Patterns on a Context Map:

When defining the relationships between bounded contexts, DDD identifies several integration patterns. These patterns describe how bounded contexts interact. Some common patterns include:


1. Shared Kernel:

   - Two or more teams agree to share a part of their models, often a small subset of the domain model. They collaborate closely to maintain consistency.


2. Customer-Supplier:

   - One context (the supplier) provides functionality that another context (the customer) depends on. The customer can influence the supplier’s development to ensure it meets their needs.


3. Conformist:

   - One bounded context (the conformist) adopts the model and design choices of another context without influencing it. This happens when the conformist context has no control over the upstream model.


4. Anti-Corruption Layer:

   - To prevent one context’s model from contaminating another, a boundary is created where translations occur between the models. This prevents "model pollution" when integrating different systems.


5. Open Host Service (OHS):

   - A bounded context exposes well-defined services or APIs that other contexts can consume, making integration easier.


6. Published Language:

   - A bounded context shares information in a common format, such as XML or JSON, that other contexts can consume. It facilitates communication between systems with different models.


Importance of a Context Map:

- Clarity in Collaboration: It clarifies how different teams and systems within an organization collaborate, reducing misunderstandings and conflicting models.

- Manage Complexity: As systems grow, the number of bounded contexts increases, making it important to clearly define how they relate to avoid integration issues.

- Strategic Design: Helps in making strategic decisions about how contexts should interact, allowing teams to align business and technical concerns.


Example:

Imagine a large e-commerce system with different bounded contexts, such as Inventory, Billing, Shipping, and Customer Support. Each context might have its own data models and services. A context map would illustrate how the Billing context integrates with the Inventory** and Shipping contexts, potentially using patterns like a Shared Kernel for common data, or an Anti-Corruption Layer to translate models between them.


In summary, the Context Map is a powerful tool in DDD for visualizing and managing the complexity of interactions between bounded contexts, helping teams to build more scalable and maintainable systems.

bottom of page