What is Domain-Driven Design
Design based on business domain
What is DDD
Domain-Driven Design (DDD) is a software development approach that focuses on modeling the business domain and close collaboration between developers and domain experts.
Strategic Design
| Concept | Description | |---------|-------------| | Bounded Context | Model boundaries with ubiquitous language | | Ubiquitous Language | Shared language of team and business | | Context Map | Map of relationships between contexts | | Subdomain | Subdomain (Core/Supporting/Generic) |
Tactical Design
| Pattern | Purpose | |---------|---------| | Entity | Object with identity | | Value Object | Immutable value object | | Aggregate | Group of related entities | | Aggregate Root | Entry point to aggregate | | Repository | Access to aggregates | | Domain Service | Business logic outside entities | | Domain Event | Event in the domain | | Factory | Creation of complex objects |
Types of Subdomains
- Core Domain — competitive advantage
- Supporting Subdomain — supports core
- Generic Subdomain — standard solutions
Integration Patterns
| Pattern | Description | |---------|-------------| | Shared Kernel | Shared core between contexts | | Customer-Supplier | Customer-supplier relationship | | Conformist | Conforming to upstream model | | Anticorruption Layer | Protection from external models | | Open Host Service | Public API of context |
When to Apply DDD
- Complex business logic
- Long-lived project
- Access to domain experts
- Team ready to invest in design