Strategic
Strategic design splits a system into bounded contexts, each with its own model, and decides how they talk without sharing that model.
Why
The catalog knows a product by its name, photos and stock. Ordering only needs its price. If ordering imports the catalog's Product class, every change in the catalog breaks ordering, and the two teams can no longer move alone.
The fix
Each context keeps its model to itself. They exchange plain JSON through a documented entry point, and each side translates it into its own words.
How the contexts meet
1The catalog opens a doorIts open host service is the only class other contexts may call.
2It answers in JSONThe published language is the contract: plain data, versioned, no class.
3Ordering translatesIts anti-corruption layer turns that JSON into its own words, behind a port.
The building blocks
| Building block | What it is | Use it when |
|---|---|---|
| Published Language | The JSON format exchanged between contexts. | Data crosses a context boundary, as a question, an answer or an event. |
| Open host services | The documented entry point of a context, the only class others may import. | Another context needs to ask yours something. |
| Anti-corruption layers | The adapter that reads another context and translates it into yours. | Your context needs something from another one. |
The events a context sends to the others are integration events, written in the published language.
See also
- Bounded contexts in the project layout
- Rule:
strategic/no-cross-context-import - Domain, the model inside each context