Overview

11 Intermission: An insurance policy for free

This chapter offers a high-level intermission that shows how secure outcomes often emerge from solid domain design and collaboration. It uses a real incident to illustrate how a perfectly “working” set of components can combine into a broken system when concepts drift between domains. The message is that deliberate context mapping and cross-domain discovery act like a free insurance policy against subtle, securable failures—especially in architectures that split responsibilities across teams and services.

The story follows an insurance company that split a monolith into finance and policy services, then added a bank giro payment option. The bank produced three messages—Payment (request registered), Confirm (funds transferred), and Bounce (transfer failed or retried). Finance mapped the bank’s Payment to its own notion of payment and continued emitting the same event to the policy service. Policy, assuming “payment means paid,” extended coverage and mailed renewal letters on receipt. When some payments later bounced, customers still held renewal letters and coverage appeared active; a crash and court case ensued. The judge ruled for the customer, interpreting the company’s mailed letters as acceptance of an outstanding debt, exposing that no single part was obviously wrong—the fault lay in mismatched semantics across domains.

The remedy is deliberate discovery and precise context mapping: involve experts from banking, finance, and policy early; favor specificity before abstraction; and let ubiquitous language reflect true domain distinctions. Concretely, rename ambiguous concepts (for example, split Payment into CashPayment and GiroPayment), wait for confirmation of funds transfer, and publish a policy-centric event (such as PolicyPayment) only when money is actually received; have policy extend coverage based on that event, not on intent-to-pay. The broader lesson for microservices is to resist myopic, service-local changes: keep maps of neighboring contexts, align meanings at integration boundaries, and be willing to change technical contracts when semantics demand it.

Figure 11.1. When a payment is made, the insurance system mails a new policy letter.
ch11 insurance over counter small
Figure 11.2. A context map showing the one single context of the monolith.
ch11 one context small
Figure 11.3. Payment for an insurance policy, across the two domains of finance and policy
ch11 separated contexts small
Figure 11.4. A Payment message arrives from the bank and is interpreted as a Payment by the finance system.
ch11 bank giro payment small
Figure 11.5. Mapping of a bank giro payment through the three domains: bank, finance, and policy
ch11 bank giro payment contextmap small
Figure 11.6. For some goods, it makes sense to take those back if payment isn’t made; for others, not so much.
ch11 lottery ticket small
Figure 11.7. A bank giro payment isn’t what you expect it to be.
ch11 bank giro payment subtlety small
Figure 11.8. A customer with a valid policy letter
ch11 car crash small
Figure 11.9. What a system does can be interpreted as what it’s intended to do.
ch11 court small
Figure 11.10. A map of the three domains after renaming Payment to CashPayment
ch11 three contexts cashpayment small
Figure 11.11. A map of the three domains with the newly created GiroPayment. What should it map to?
ch11 three contexts giropayment unmapped small
Figure 11.12. The difference between early deliberate discovery and late ignorant discovery
ch11 deliberate discovery small
Figure 11.13. A map of the three domains with complete mappings
ch11 three contexts giropayment mapped small

 Summary

  • Do deliberate discovery early to get deep insights into subtle aspects of the domain.
  • Start specific, then abstract later.
  • Collect expertise from all adjacent domains.
  • Refactor names if they change semantics, especially if they change semantics outside the bounded context.

FAQ

What core lesson does “An insurance policy for free” illustrate?That a system-of-systems can fail even when no single part is “broken.” Security and correctness depend on shared understanding across bounded contexts; identical words (like “payment”) can carry different meanings and cause harmful emergent behavior if mappings are wrong.
How did splitting the monolith into finance and policy contribute to the issue?After the split, teams drifted apart and reused the same “Payment” message for different meanings. Finance started treating a bank’s “Payment” notice as if money had arrived, and policy continued to trigger renewals on that event, without a shared review of the changed semantics.
What do the bank giro messages Payment, Confirm, and Bounce actually mean?Payment means a payment request was registered (no money moved yet). Confirm means the transfer completed and funds have arrived. Bounce means the transfer failed; the bank may retry until remaining attempts reach zero.
Why must an insurer wait for confirmed payment before issuing coverage?Coverage, like a lottery ticket, can’t be “taken back” if unpaid; customers would benefit during the period and only pay after a loss. For most policies, the business invariant is “coverage starts only when we are truly paid,” not merely promised payment.
What exactly went wrong in the story?The finance system treated the bank’s Payment notice as an actual payment and emitted it to policy. The policy system created a new policy period and mailed a renewal letter. When funds later failed to transfer (no Confirm, eventual Bounce), policy still believed payment had occurred, effectively granting coverage for free.
How did the court interpret the mailed policy letter?The judge ruled the letter showed the company accepted the continued agreement and, if not fully paid, accepted an outstanding debt. Legally, the company’s behavior (issuing the letter) trumped the internal “bug” explanation.
Where was the bug located: in a component or in the integration?In the integration and mappings across contexts. Each system was reasonable in isolation, but the cross-context interpretation of “payment” was wrong, producing an unsafe overall outcome.
How could deliberate context mapping have prevented this?By explicitly modeling and discussing mappings with experts from banking, finance, and policy. That conversation would reveal that policy should act on “Confirmed payment received,” not on “payment registered,” aligning events with the business invariant.
What refactorings and concepts does the chapter suggest?Be specific first: rename Payment to CashPayment for over-the-counter payments; introduce GiroPayment for bank giro flows; create a PolicyPayment abstraction emitted only when the company is actually paid (immediately for CashPayment, upon Confirm for GiroPayment). Policy then listens for PolicyPayment, not generic Payment.
What guidance does the chapter offer for microservices?Microservices don’t remove the need for cross-team communication. Avoid myopic, single-service changes; always consider neighboring services and shared language. Don’t integrate by matching strings—ensure semantics are aligned with domain invariants.

pro $24.99 per month

  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose one free eBook per month to keep
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime

lite $19.99 per month

  • access to all Manning books, including MEAPs!

team

5, 10 or 20 seats+ for your team - learn more


choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • Secure by Design ebook for free
choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • Secure by Design ebook for free
choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • Secure by Design ebook for free