Domain-Driven Design
An approach to complex software that builds evolving models from domain knowledge and aligns language, boundaries, code, and team collaboration.
Download Markdown (.md)Soroush’s Product Wiki · https://wiki.soroush.uk/topic/domain-driven-design/
01What it means
Domain-Driven Design, or DDD, centers software development on a model of the business domain: its concepts, rules, processes, and relationships. Developers and domain experts refine a shared ubiquitous language used in discussion and code. Large domains are divided into bounded contexts, each with an internally consistent model and explicit relationships to other contexts.[1][2][3]
- Domain experts
- Operational knowledge and meaningful distinctions
- Ubiquitous language
- Shared terms used in conversation, models, and code
- Bounded contexts
- Explicit boundaries where a model and language apply
- Context map
- Relationships and translations between boundaries
- Implementation
- Code expresses and tests the current model
- Learning loop
- Software and language change as understanding improves
DDD is most useful where business rules and language are genuinely complex; it is not a mandate for microservices or elaborate tactical patterns.
02Why it matters
In complex products, the hardest failures often come from misunderstood rules and ambiguous terms rather than programming syntax. DDD makes those assumptions discussable and places important business behavior in a model instead of scattering it across screens, scripts, and database procedures. Bounded contexts also help teams manage conflicting meanings and define clearer ownership boundaries.
03When to use it
Use DDD where domain rules are rich, changing, differentiating, or contested—for example lending, logistics, healthcare, or marketplace operations. Apply strategic patterns selectively even if tactical object patterns do not fit the technology. For straightforward data entry or commodity capabilities, elaborate domain modeling may cost more than it returns.
04How it works
- Work with domain experts to explore workflows, rules, exceptions, terminology, and sources of complexity.
- Develop a ubiquitous language and use it consistently in conversations, examples, tests, and code.
- Separate the wider domain into subdomains and identify where distinct models need bounded contexts.
- Map relationships between contexts, including ownership, translation, published interfaces, and dependencies.
- Model behavior inside important contexts with suitable patterns such as entities, value objects, and aggregates.
- Continuously refine the model as product learning reveals better language or boundaries.
05A practical example
A marketplace discovers that “order” means a commercial commitment in sales, a pick-and-pack instruction in fulfillment, and a settlement unit in finance. Rather than forcing one giant model, it creates separate bounded contexts and explicit mappings. Each team can evolve its rules without making every meaning of order change together.
06Where it breaks
DDD is a learning and design approach, not a folder structure or automatic route to microservices. It demands sustained access to knowledgeable people and willingness to revise code as understanding improves. Excessive tactical patterns can obscure simple logic, while poorly chosen context boundaries can move complexity into brittle integrations.
Common mistakes
- Reducing DDD to entities, repositories, and other code patterns while skipping collaborative domain learning.
- Creating one enterprise-wide canonical model despite meaningful differences in language and responsibility.
- Assuming every bounded context must become a separately deployed microservice.
- Letting technical layers or organizational politics define boundaries without examining business cohesion.
07Sources
- Domain-Driven Design ReferenceDomain Language · Primary author referenceDomain-Driven Design Reference
- Domain Driven DesignMartin Fowler · Expert overviewDomain Driven Design
- Use Domain Analysis to Model MicroservicesMicrosoft Learn · Institutional architecture guideUse Domain Analysis to Model Microservices