Subdomains and bounded contexts
Subdomains describe the business areas; bounded contexts are the parts of the system with their own model and vocabulary, and implement subdomains.
Subdomains
A subdomain is an area of the business: Ordering, Payments, Identity. Give it a summary, a description and a classification. The Subdomains page lists them by classification.
Bounded contexts
A bounded context is a part of the system with its own model and language: Orders, Billing, Catalog. It has a summary (500 characters at most), a description, an icon and a colour for its card, the subdomains it implements and its context map. A subdomain shows the contexts that implement it.
A context page has five tabs:
The context map
A bounded context lists the contexts it depends on, in its upstreams: each entry names a context, a pattern and an optional note, such as "Payments publishes PaymentCaptured". On the Overview tab, Add to context map opens the picker.
- A context lists another context once, and never itself.
- When two contexts list each other in ways that do not match, both get a warning (
context-map-mismatch) naming the other context. - The Overview tab also shows, read only, the contexts Downstream of this one and its Peers.
- The System map draws the declared relations, labelled with their pattern, next to the ones it derives from references.
Where the boundaries go
Draw a context boundary where one of these is true:
- A word changes meaning: an Order in Orders is not an Order in Fulfilment.
- A team owns the code.
- A model must stay consistent inside and may lag outside.
Data contracts and integration events are how contexts talk; see Data contracts, read models and integration events. The context map says who depends on whom.
Moving an artefact to another context
Changing the context of an aggregate, value object or enum moves it. Its id and every reference to it stay.