Chapter I · Area 04 of 12

Domain modelling

The Question for Our ShopDo order and invoice mean the same thing when both speak of an “amount”?

Learn how domain language, models and responsibilities shape your design.

Three questions for every domain model

  1. Which words apply?

    Language

    The shop team defines order, reservation, authorisation and invoice, each with a verifiable meaning.

  2. Where does each model apply, and how do models relate?

    StrategicStrategic design

    Order and invoice are separate contexts; an ACL translates the payment provider’s codes.

  3. What must remain consistent within a model?

    TacticalTactical design

    B-1042 needs at least one line item; two amounts of €49.90 are the same value.

This is how the building blocks hang together

Domain-driven design connects domain knowledge and model. Ubiquitous language sharpens terms, bounded contexts mark where they are valid, value objects and aggregates shape states, and the context map and ACL govern the transitions.

ConceptBounded ContextA bounded context defines where a domain model and its terms apply.ApproachDomain-Driven Designorganises modelling around domain knowledge and uses bounded contexts as the key boundaryPrincipleUbiquitous Languagekeeps terms and rules consistent within a contextConceptAggregateprotect invariants within a clear consistency boundaryConceptEntities & Value Objectsdistinguishes values from objects with identity within a bounded contextArtifactContext Mapshows direction and collaboration between bounded contextsPatternAnti-Corruption Layertranslates foreign terms into the language of your own model
Relations: Domain-Driven Design organises modelling around domain knowledge and uses bounded contexts as the key boundary; Ubiquitous Language keeps terms and rules consistent within a context; Aggregate protect invariants within a clear consistency boundary; Entities & Value Objects distinguishes values from objects with identity within a bounded context; Context Map shows direction and collaboration between bounded contexts; Anti-Corruption Layer translates foreign terms into the language of your own model.

Your learning path through the area

Domain modelling clarifies which words apply in the shop, where a model ends and how models relate. That way order and invoice do not mean the same by “amount”, and every rule has its place. Each building block shows its theme at our shop.

  1. This is what you learnYou can classify subdomains as core, supportive, or generic and steer the modeling effort accordingly.

    In the shopIn the shop, not all modules are equally important. The order rules distinguish him, the payment he buys from the payment provider. The team then adjusts its modelling effort.

    Domain-Driven Design Open
  2. This is what you learnYou can replace ambiguous shop terms with precise technical terms that are uniform in the respective context.

    In the shopThe shop team clarifies the words order, reservation, authorization and invoice. Each term receives a testable meaning in the appropriate context.

    Ubiquitous Language Open
  3. This is what you learnYou can define the scope of a model by your own terms, rules and responsibility.

    In the shopOrder and invoice are two contexts in the shop. Both know an amount and a status, but use these terms for different business purposes.

    Bounded Context Open
  4. This is what you learnYou can distinguish objects with persistent identity from immutable business values.

    In the shopOrder B-1042 Despite the change of status, the same order remains. Two sums of money from 49,90 EUR are technically the same as soon as the amount and currency match.

    Entities & Value Objects Open
  5. Aggregate

    Tactical

    This is what you learnYou can set a consistency boundary and make changes about its business root.

    In the shopOrder B-1042 contains positions and a delivery address. Their rules require at least one position, a positive amount per position and an order sum that matches the positions.

    Aggregate Open
  6. Context Map

    Strategic

    This is what you learnYou can describe relationships between business contexts with direction, information exchanged, and translation.

    In the shopIn the shop, there are relationships within the team, in which warehouse, payment and order are coordinated. Externally, there is a relationship with the payment provider, whose model does not influence the shop.

    Context Map Open
  7. This is what you learnYou can translate a foreign data model into your own specialist model at an integration boundary.

    In the shopThe payment provider provides the codes APPROVED, DECLINED and PENDING_REVIEW. The shop uses its own states authorized, rejected and clarification is ongoing.

    Anti-Corruption Layer Open
Afterwards in the learning path · area 05Styles & patterns