This example illustrates the Context Mapper DSL capabilities on the basis of a fictitious insurance company scenario. The bounded contexts are partially inspired by the Lakeside Mutual project. Note that the goal of the example is to give a representative overview over the DSL's context mapping features. The contexts and their relationships may differ considerably in a real-world insurance company.
The following figure illustrates the Context Map in a graphical representation inspired by Vernon and Brandolini.
You can find the corresponding context map in CML (Context Mapper Language) here in different versions and levels of detail (stages). The first four stages do not contain detailed domain models and should be understandable for users without technical knowledge (business analysis only). The last stage contains details of the domain models including attributes for all domain objects and are designed for software engineers and architects.
- Insurance-Example-Stage-1: A simple context map without relationship patterns in upstream-downstream relationships and without details of the bounded contexts.
- Insurance-Example-Stage-2: This stage refines the relationships on the context map and adds the corresponding DDD relationship patterns.
- Insurance-Example-Stage-3: In stage three we added first details to the bounded contexts and specified the aggregates.
- Insurance-Example-Stage-4: A simple version including all domain objects but no attributes. This stage should still be understandable for users without technical knowledge.
- Insurance-Example-Stage-5: Finally, a detailed context map on the architect and engineering level. All domain objects are specified in detail (including attributes). This example further contains methods in aggregate root entities.
- Insurance-Example_Alternative-Relationship-Syntax: The simple context map example in stage two, but illustrating the alternative relationship syntax.
- Insurance-Example_User_Representations: Service Cutter user representations file (for Service Cutter integration) to generate new service cuts
The following bounded contexts are involved in the system:
- Customer Management
- Customer Self-Service Management
- Policy Management
- Debt Collection
- Risk Management
- Printing Context
Besides classic context maps with bounded contexts, CML supports modeling teams and their relationships as it is possible with bounded contexts. This is done by simply change the type of a bounded context from SYSTEM, FEATURE or APPLICATION to TEAM. Note that the type of the context map is ORGANIZATIONAL in this case.
- Insurance-Example_Team-Map: A team map example for the insurance scenario
As you can see in the example linked above, you can further use the realizes to define which teams work on which systems, applications, or features. By using the graphical Context Map generator, you can then generate team maps that illustrate the relations between development teams and system bounded contexts.
Depending how you parameterize the generator, the produced illustrations will be unclustered...
... or clustered:
The customer management context is responsible for managing all the data of the insurance companies customers. Thus, it is typically a central bounded context which has relationships to many other contexts.
This context represents a web application which allows the customer to login and change basic data records like the address.
This bounded context manages the contracts and policies of the customers. It works in a partnership together with the risk management context, since it needs the customer risk data for calculating the customer rates. Further, it has a shared kernel with the debt collection context.
The debt collection context is responsible for the financial income of the insurance company (the debts) which depend on the corresponding contracts and policies.
The risk management context works in a close relationship with the policy management context and calculates risks which influence contracts and policies.
This context represents an external system which is accessed by an API by many internal contexts. It handles documents which have to be printed, as for example debts, policies, etc.