Skip to content

Bounded context

  • When you have multiple models you should consider Bounded Contexts
  • Bounded Context provides capabilities to the rest of domain
  • Each Bounded Context is a self contained "mini application" containing it’s own model, persistence and code base
  • Bounded Context is an autonomous subsystem with a well-defined boundary
  • Bounded Context is an abstract element of the architectural design
  • To map between Bounded Contexts you use a Context Map

Bounded Contexts are like isolated islands, but still they are interconnected.

Subdomains

  • Whole domain can be too complex
  • Subdomain is logical sub-part of whole business domain
  • Area of expertise
  • Subdomain types
    • Core: is what a company does differently from its competitors
      • Advanced Library search
    • Supporting: support the company’s business
      • Notification/Marketing emails
      • Reporting
    • Generic: business activities that all companies are performing in the same way, they do not provide any competitive advantage
      • IAM
      • API Management
      • Payment

Context Mapping

The outcome of a DDD analysis of business domain requirements is a collection of bounded contexts that, when combined, form the whole set of functions to implement.

Context Contract

We want to reduce coupling between bounded contexts as much as possible, but a shared communication format (API Request, Event) always induces some coupling.

  • Confromist
  • Customer-Supplier
  • Partnership
  • Shared Kernel
  • Anti-Corruption Layer
  • Open Host Service
  • Published Language
  • Separate Ways

The above relationships can be outlined as connection between Upstream and Downstream contexts.

up-down

  • An upstream bounded context influences a downstream bounded context
  • The code (library, or generated code from contract specification) in the upstream context is available as a reference to the downstream context
  • The schedule of work in the upstream context cannot be changed on demand by the team managing the downstream context
  • The response of the upstream team to requests for change may not be as prompt as desired by the downstream team