DDD (domain-driven design)
Designing software around the business’s own language and rules, with the code split where that language changes meaning.
Developers and domain experts agree on terms (the ubiquitous language) and the code uses the same words. The strategic part draws bounded contexts and maps how they talk to each other; the tactical part gives building blocks such as entities, value objects and aggregates. Most of the value is in the strategic part; teams that adopt only the building blocks often get extra layers and little else.
The term comes from Eric Evans’s 2003 book; his free DDD Reference summarizes every pattern, and Martin Fowler gives a short overview. The table below lists the DDD terms in this glossary: the strategic ones such as context map and core domain, and the tactical ones such as value object and domain event.
| Term | Part | In one sentence |
|---|---|---|
| Bounded context | strategic | A border inside which each term has one meaning and one model. |
| Ubiquitous language | strategic | The shared vocabulary used by experts and in the code. |
| Domain expert | strategic | The person whose knowledge the model captures. |
| Core domain | strategic | The part that sets the business apart; the rest is supporting or generic. |
| Context map | strategic | How contexts relate: who is upstream, who translates. |
| Customer-supplier | context map | Upstream plans with the downstream team’s needs. |
| Conformist | context map | Downstream takes the upstream model as it is. |
| Anti-corruption layer | context map | Downstream translates the other model at one border. |
| Shared kernel | context map | A small piece of model two teams own together. |
| Open host service | context map | One documented protocol for all consumers. |
| Partnership and separate ways | context map | Release together, or do not integrate at all. |
| Entity | tactical | An object with an identity that survives changes. |
| Value object | tactical | An immutable object defined only by its values. |
| Aggregate | tactical | A cluster of objects saved together to protect its rules. |
| Business invariant | tactical | A rule that must always hold. |
| Domain event | tactical | A past-tense business fact others can react to. |
| Domain service | tactical | Business logic that belongs to no single entity. |
| Repository | tactical | A collection-like access to aggregates. |
| Event storming | practice | A workshop that maps the domain as events on a wall. |
| Anemic domain model | anti-pattern | Data-only objects with the rules in services. |
Sources
- Domain Language: DDD Reference domainlanguage.com
- Martin Fowler: Domain Driven Design martinfowler.com
Related terms
- Bounded context: A part of a system where each business term has one meaning and one model, with explicit translation at its edges.
- Ubiquitous language: One shared vocabulary for a domain, used the same way by experts, developers and the code itself.
- Context map (DDD): A diagram of the bounded contexts in a system and the kind of relationship between each pair: who depends on whom and how models are translated.
- Core domain (subdomains): The part of the business that sets it apart from competitors; supporting and generic subdomains are the rest, which can stay simple or be bought.
- Aggregate (DDD): A cluster of objects changed as one unit, with a single root that enforces the business rules and marks the boundary of one transaction.
- Entity (DDD): A domain object with its own identity that stays the same while its data changes, such as a patient, an order or a doctor’s profile.
- Value object: A small immutable object defined only by its values, like money or a date range; two with the same values are the same thing.
- Domain event: A fact the business cares about, named in the past tense (“visit booked”), that other parts of the system can react to without being called directly.
- Anti-corruption layer (ACL): A translation layer between your model and a legacy or external system, so its data shapes and quirks do not leak into your code.
- Event storming: A workshop where business and technical people map a process as a timeline of events on sticky notes to find rules, gaps and boundaries.
