DDD Overview
DDD Overview
Domain-Driven Design (DDD) is a way of modelling complex business software so the code looks like how domain experts talk about the business. Two halves: strategic (where the model lives) and tactical (what the model is made of).
Strategic DDD: structuring the system
How the system is divided into modelling territories.
- Bounded Context & Ubiquitous Language — a model boundary where one shared language consistently means the same thing. Includes Context Maps (how contexts relate) and Subdomains (Core / Supporting / Generic).
Tactical DDD: building the model
The building blocks inside one bounded context.
- Bounded Context & Ubiquitous Language — strategic boundary + shared vocabulary.
- Entity — identity persists across state changes.
- Value Object — defined by value, immutable, self-validating.
- Aggregate (Root) — consistency boundary; one transaction equals one aggregate.
- Repository — collection-like access to aggregates.
- Domain Service — stateless logic that spans multiple entities/VOs.
- Domain Event — immutable past-tense fact; subscribers react.
What DDD is not
- Not a folder structure. DDD doesn't say "put entities in
entities/". Folder organisation is a separate decision. - Not OOP-specific. Most building blocks (VO, aggregate, event) work in any paradigm.
- Not framework-coupled. No "DDD framework". Patterns work in plain Python, Go, TypeScript.
- Not for every project. CRUD apps don't need it. Reach for DDD when domain complexity justifies the upfront cost.
When DDD pays off
- The business has non-trivial rules ("a Loan becomes Overdue when…").
- Domain experts and developers talk regularly — DDD is a collaboration tool.
- The system is expected to evolve with the business; refactoring against a clean model is cheaper.
When DDD is overkill
- The whole app is CRUD over a known schema.
- The domain is simple and stable.
- Solo developer with no domain expert to talk to.
Common confusions
- DDD != Clean Architecture / Hexagonal. They compose, but answer different questions: DDD is what the model is; Clean Architecture is where it lives.
- DDD != CQRS / Event Sourcing. Often paired, neither required.
- Domain Event != Integration Event. Same idea, different scope.
Where to start
- Identify your bounded contexts — most projects only have a handful.
- Pick one context; nail the ubiquitous language with domain experts.
- Model aggregates small. Bigger aggregates always look easier and always cost more later.
- Use value objects ruthlessly. Replace
strfor emails,intfor cents, with VOs that enforce invariants. - Repositories last — once the model stabilises, persistence is the easy part.