Understanding Domain‑Driven Design: Strategic and Tactical Concepts for Complex Business Systems
This article introduces Domain‑Driven Design, explaining its strategic and tactical aspects, core concepts such as bounded contexts, ubiquitous language, aggregates, entities, and value objects, and illustrates how DDD can be applied to complex business domains like hotel transaction systems.
Author Introduction – Li Xin
Li Xin joined Qunar in 2014, worked as a software R&D engineer, and now leads the domestic hotel transaction technology team, focusing on high‑concurrency, micro‑service availability, and system elasticity.
1. Preface
Software development is often divided into waterfall and agile approaches. Waterfall suffers from low feedback frequency and large deviation between expectations and delivery, while agile emphasizes short cycles, early usable releases, and continuous iteration, though it may increase maintenance cost due to frequent changes.
2. What is DDD?
Domain‑Driven Design (DDD) starts with extensive business knowledge gathering, forming a domain model that drives software design. In micro‑service architectures, DDD helps define clear domain boundaries, enabling better handling of complex business systems.
3. Value of DDD
Clear business model boundaries help both business and developers articulate complex rules, while a ubiquitous language reduces communication gaps and supports strategic and tactical technical decisions.
4. Core Pillars of DDD
The two main pillars are ubiquitous language and bounded contexts. Building a shared language requires time, analysis, and collaboration with domain experts, followed by event‑storming to define boundaries and contexts.
5. Core Concepts
Key concepts include strategic design, tactical design, domain, bounded context, entity, value object, domain service, aggregate, factory, domain event, repository, etc.
6. Strategic Design
Strategic design creates a business‑centric domain model, defines boundaries, establishes ubiquitous language, and identifies bounded contexts through event‑storming and scenario analysis.
7. Tactical Design
Tactical design models entities, value objects, domain services, events, modules, aggregates, and repositories. It includes principles for building aggregates, ensuring consistency, and handling inter‑aggregate communication.
8. Ubiquitous Language
A shared language formed by team collaboration eliminates misunderstandings, allowing business terms to be directly reflected in code.
9. Event Storming
Event storming rapidly explores complex domains by identifying events, commands, and roles, then grouping them into aggregates and bounded contexts.
10. Practical Application – Hotel Transaction
The article walks through analyzing the order problem space, defining solution space, identifying roles, commands, and events, and establishing aggregates such as Order, Payment, and Fulfillment, each with its own consistency rules.
11. Aggregate Principles
Principles include ensuring strong consistency within an aggregate, using asynchronous event‑driven communication for inter‑aggregate consistency, keeping aggregates small, and applying eventual consistency outside aggregate boundaries.
12. Entity and Value Object Models
Entities have unique identifiers and mutable state, while value objects are immutable, stateless, and identified only by their attributes. Various modeling styles (anemic, rich, etc.) are discussed.
13. Theoretical Summary
DDD provides a scientific method from strategic to tactical design, helping teams handle complex business domains, improve OO thinking, and create robust, evolvable systems.
Qunar Tech Salon
Qunar Tech Salon is a learning and exchange platform for Qunar engineers and industry peers. We share cutting-edge technology trends and topics, providing a free platform for mid-to-senior technical professionals to exchange and learn.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.