Journal of Distributed Software Engineering, Architecture and Design
DDD Context Mapping by example: Policy Management
<div class="cs-rating pd-rating" id="pd_rating_holder_1819065_post_1990"></div>
<p class="wp-block-paragraph">DDD context mapping can be confusing without real-world examples. In this post we will model sample implementations for two scenarios using bounded context maps and learn to analyse the relationships from the maps. With this post, I hope to give you a fair idea of how to do apply DDD into build good distributed features and integrations using strategic and tactical design patterns</p>
<p class="wp-block-paragraph">Context mapping and analysis leads to deeper insights in the way we build our software integrations because it uncovers hidden dependencies. Note, these maps are not the same as system integration diagrams as they show business contexts and relationships – if modelling the current state, these maps then show the current state of your socio-technical landscape</p>
<h2 class="wp-block-heading">Customer and interactions: Our sample stories</h2>
<p class="wp-block-paragraph">Customers interact with our software via web, mobile channels in a self-service context or via support centres by interacting with a Customer Support Representative. Let us consider an example of customer interaction from Insurance Domain</p>
<p class="wp-block-paragraph">There are 2 contexts</p>
<ol class="wp-block-list"><li>Self-service Policy Management Context: Policy Portal where the customer can buy policy and manage his/her contact details</li><li>Customer Relationship Management Context: This is where the actor, our customer, calls the help desk and a CSR agent pulls their information </li></ol>
<figure data-carousel-extra='{"blog_id":1,"permalink":"https://alok-mishra.com/2021/06/29/ddd-context-mapping-by-example-policy-management/"}' class="wp-block-gallery columns-2 is-cropped wp-block-gallery-1 is-layout-flex wp-block-gallery-is-layout-flex"><ul class="blocks-gallery-grid"><li class="blocks-gallery-item"><figure><a href="https://alok-mishra.com/wp-content/uploads/2021/06/screen-shot-2021-06-29-at-3.37.34-pm.png?w=1024"><img src="https://alok-mishra.com/wp-content/uploads/2021/06/screen-shot-2021-06-29-at-3.37.34-pm.png?w=1024" alt="" data-id="1992" data-link="https://alok-mishra.com/screen-shot-2021-06-29-at-3-37-34-pm/" class="wp-image-1992" /></a></figure></li><li class="blocks-gallery-item"><figure><a href="https://alok-mishra.com/wp-content/uploads/2021/06/screen-shot-2021-06-29-at-3.37.21-pm.png?w=1008"><img src="https://alok-mishra.com/wp-content/uploads/2021/06/screen-shot-2021-06-29-at-3.37.21-pm.png?w=1008" alt="" data-id="1993" data-link="https://alok-mishra.com/screen-shot-2021-06-29-at-3-37-21-pm/" class="wp-image-1993" /></a></figure></li></ul><figcaption class="blocks-gallery-caption">Domain stories for our sample customer interactions: Customer Self-Service context and Customer Management via Support context</figcaption></figure>
<p class="wp-block-paragraph">Lets us now look at these two contexts in a specific implementation, draw context maps and analyse this implementation for its merits, issues etc</p>
<h2 class="wp-block-heading">Policy management from portal</h2>
<p class="wp-block-paragraph">In our example, there is a policy portal that imagines a web layer, an Experience Adapter, a domain service for Policy API and one for Customer API. Here are some specific implementation details from our example</p>
<ol class="wp-block-list"><li>The customer can manage their contact details which is implemented as real-time consistent via the experience layer invoking the customer domain service </li><li>The customer can manage their Policy. Adding new contacts on the account leads to a real-time API invocation to the backend customer system via the Customer API</li></ol>
<figure class="wp-block-image size-large"><a href="https://alok-mishra.com/wp-content/uploads/2021/06/policymanagementstory.jpg"><img src="https://alok-mishra.com/wp-content/uploads/2021/06/policymanagementstory.jpg?w=1024" alt="" class="wp-image-1981" /></a><figcaption>Context 1: Policy Management from Customer Portal </figcaption></figure>
<p class="wp-block-paragraph">How about drawing a context map for this? What are the bounded contexts and the relationships? What does it tell us?</p>
<figure class="wp-block-image size-large"><a href="https://alok-mishra.com/wp-content/uploads/2021/06/screen-shot-2021-06-29-at-3.19.26-pm.png"><img src="https://alok-mishra.com/wp-content/uploads/2021/06/screen-shot-2021-06-29-at-3.19.26-pm.png?w=1024" alt="" class="wp-image-1987" /></a><figcaption>Context map for Policy Implementation: Quite the picture</figcaption></figure>
<p class="wp-block-paragraph">This context map tells us the following</p>
<ol class="wp-block-list"><li>There is a “customer policy management” context (gray circle) that contains two sub-contexts and our software needs to handle these</li><li>All the customer policy management sub-contexts depend on the Identity management context. They consume the Identity management services in a fairly self-service manner</li><li> There are 2 Policy Management contexts – “my” (self-service) and “customer” (internal user)</li><li>Both policy management contexts directly depend on customer relationship management context- is this true though? </li></ol>
<p class="wp-block-paragraph">The #4th point above does not read correctly because we want to be able to show that the contexts read/write to the same database (CRM contacts and account table). The Customer API is a poor and leaky abstraction. We can redo the picture as </p>
<figure class="wp-block-image size-large"><a href="https://alok-mishra.com/wp-content/uploads/2021/06/screen-shot-2021-06-29-at-3.24.52-pm.png"><img src="https://alok-mishra.com/wp-content/uploads/2021/06/screen-shot-2021-06-29-at-3.24.52-pm.png?w=1024" alt="" class="wp-image-1988" /></a><figcaption>Context map for Policy Implementation: Iteration #2 – Shared Kernel between CRM context and all other contexts</figcaption></figure>
<p class="wp-block-paragraph"><strong>Take away: </strong>Key takeaway here is that shared kernel (SK) indicated long term collaboration. This implementation would imply some of the attributes of the policy systems leaked into the CRM table and strong-coupling in the two contexts leads to inability to change these or worse business outages as rules in the CRM world conflict with the Invoice management world!</p>
<h2 class="wp-block-heading">Customer Management from CRM: Customer 360</h2>
<p class="wp-block-paragraph">In the next post we will see how to do Customer Management and Customer 360. Read the full post <a href="https://wordpress.com/post/techiecook.com/1996">here</a></p>
DDD context mapping can be confusing without real-world examples. In this post we will model sample implementations for two scenarios using bounded context maps and learn to analyse the relationships from the maps. With this post, I hope to give you a fair idea of how to do apply DDD into build good distributed features and integrations using strategic and tactical design patterns
Context mapping and analysis leads to deeper insights in the way we build our software integrations because it uncovers hidden dependencies. Note, these maps are not the same as system integration diagrams as they show business contexts and relationships – if modelling the current state, these maps then show the current state of your socio-technical landscape
Customer and interactions: Our sample stories
Customers interact with our software via web, mobile channels in a self-service context or via support centres by interacting with a Customer Support Representative. Let us consider an example of customer interaction from Insurance Domain
There are 2 contexts
Self-service Policy Management Context: Policy Portal where the customer can buy policy and manage his/her contact details
Customer Relationship Management Context: This is where the actor, our customer, calls the help desk and a CSR agent pulls their information
Domain stories for our sample customer interactions: Customer Self-Service context and Customer Management via Support context
Lets us now look at these two contexts in a specific implementation, draw context maps and analyse this implementation for its merits, issues etc
Policy management from portal
In our example, there is a policy portal that imagines a web layer, an Experience Adapter, a domain service for Policy API and one for Customer API. Here are some specific implementation details from our example
The customer can manage their contact details which is implemented as real-time consistent via the experience layer invoking the customer domain service
The customer can manage their Policy. Adding new contacts on the account leads to a real-time API invocation to the backend customer system via the Customer API
Context 1: Policy Management from Customer Portal
How about drawing a context map for this? What are the bounded contexts and the relationships? What does it tell us?
Context map for Policy Implementation: Quite the picture
This context map tells us the following
There is a “customer policy management” context (gray circle) that contains two sub-contexts and our software needs to handle these
All the customer policy management sub-contexts depend on the Identity management context. They consume the Identity management services in a fairly self-service manner
There are 2 Policy Management contexts – “my” (self-service) and “customer” (internal user)
Both policy management contexts directly depend on customer relationship management context- is this true though?
The #4th point above does not read correctly because we want to be able to show that the contexts read/write to the same database (CRM contacts and account table). The Customer API is a poor and leaky abstraction. We can redo the picture as
Context map for Policy Implementation: Iteration #2 – Shared Kernel between CRM context and all other contexts
Take away: Key takeaway here is that shared kernel (SK) indicated long term collaboration. This implementation would imply some of the attributes of the policy systems leaked into the CRM table and strong-coupling in the two contexts leads to inability to change these or worse business outages as rules in the CRM world conflict with the Invoice management world!
Customer Management from CRM: Customer 360
In the next post we will see how to do Customer Management and Customer 360. Read the full post here
Alok brings experience in engineering and architecting distributed software systems from over 20 years across industry and consulting. His posts focus on Systems Integration, API design, Microservices and Event driven systems, Modern Enterprise Architecture and other related topics
View all posts by alokmishra