16 Nov 2023



Advanced

Context mapping is a strategic modeling tool used in Domain-Driven Design (DDD) to visualize and understand the relationships between bounded contexts within a software system. It helps to identify and clarify the boundaries between different areas of domain knowledge, fostering a common understanding among domain experts, developers, and stakeholders.

Purpose of Context Mapping

Context mapping serves several key purposes in DDD:

  1. Identifying Bounded Contexts: It helps to identify and delineate bounded contexts, which are self-contained units of domain knowledge with explicit boundaries.

  2. Understanding Relationships: It visualizes the relationships between bounded contexts, revealing how they interact and exchange information.

  3. Clarifying Ubiquitous Language: It promotes the development of a consistent ubiquitous language by identifying shared and distinct terms across contexts.

  4. Guiding Integration Design: It informs the design of integration patterns between bounded contexts, ensuring seamless communication and collaboration.

Creating a Context Map

A context map is typically created collaboratively by domain experts, architects, and developers. It involves the following steps:

  1. Identify Bounded Contexts: Start by identifying the key bounded contexts in the system based on domain knowledge and business requirements.

  2. Represent Bounded Contexts: Represent each bounded context as a distinct shape or box on the map, labeled with its name and core domain concepts.

  3. Define Relationships: Identify the relationships between bounded contexts, such as collaboration, dependency, or ownership.

  4. Draw Communication Flows: Represent communication flows between contexts using arrows, indicating the direction and type of information exchange.

  5. Label Flows with Roles: Label each communication flow with the roles involved, such as publisher, subscriber, or consumer.

  6. Annotate with Details: Add notes and annotations to clarify specific aspects of the relationships and interactions.