Lesson 6 of the DDD course · Strategic design: where models are valid, and where your edge actually is · ~25 minutes
Lessons 1–5 were tactical: patterns inside one model. The rest of DDD is strategic: how many models, where they start and stop, and who translates between them. This lesson gives you the two strategic nouns.
| Subdomain | Bounded context | |
|---|---|---|
| Question | Where does the business problem live? | Where does a specific model work? |
| Space | problem space — the business | solution space — your code |
| Meridian examples | merchandising, ordering, payment processing | Catalog module, Ordering module, Billing module |
A subdomain is a part of the business itself — it exists whether or not you write software. A bounded context is the region of your code where one particular model — with one ubiquitous language — is valid.[Evans] They rhyme but don't map 1:1: one subdomain might be served by two evolving contexts; one context might serve two.
Khononov's classification tells you where to spend your scarcest resource — attention:[Khononov]
The deep reason contexts exist: “product” is not one concept. Listen to how each Meridian team uses the word:
| Context | “Product” means… | Model cares about |
|---|---|---|
| Catalog | a thing to browse and fall in love with | title, photos, description, SEO |
| Ordering | a purchasable snapshot on a line | sku, unit price, availability flag |
| Shipping | a box's contents | weight, dimensions, hazmat class |
Forcing one Product type to serve all three gives you a type with thirteen
optional fields where every consumer uses three — the illegal-state problem again, but
organizational. The DDD answer: each context gets its own Product, speaking its own
language. Translation happens where contexts meet (next lesson).
src/
catalog/ # its own model, its own language
types.ts # CatalogProduct: title, photos, …
ordering/ # lessons 1–5 live here
types.ts # Order, OrderLine, OrderEvent…
transitions.ts
billing/
types.ts # PaymentCaptured, Invoice…
shared/
result.ts # Result, err — infrastructure, not domain language
CatalogProduct appearing in ordering/ is a
boundary leak — the smell test is mechanical: grep.sku: SkuId, not a catalog object. The id is the whole contract.Result, ids, clocks). (3) If a word needs a meeting to define, you've found a
context boundary: the word means different things to different groups.
You can now draw Meridian's map: Catalog, Ordering, Billing, Shipping — each with its own language. But they must talk: orders need payment confirmations, shipping needs weights. Next lesson: context mapping — the translation patterns between contexts, including the anti-corruption layer for the payment provider you'll never control.