Applying Domain‑Driven Design: Architecture Evolution, Bounded Contexts, and Clean Architecture
This article explains how to start a new project using Domain‑Driven Design, covering key terminology, architecture evolution from monolith to microservices, bounded context division, the four DDD boundaries, clean layered, hexagonal and onion architectures, and practical design guidelines for backend systems.
Hello, I am a top architect. We have heard of DDD and now explore how to divide and design a new project from scratch using the DDD process.
1. Professional Terminology
IAAS: Infrastructure‑as‑a‑Service.
PAAS: Platform‑as‑a‑Service.
SAAS: Software‑as‑a‑Service.
2. Architecture Evolution
The diagram shows the evolution from a monolithic application (SAAS) to layered MVC/SSM, then to PAAS‑style microservices, and finally to IAAS‑style containerized deployments.
SAAS : Early single‑tier applications where business logic is tightly coupled.
PAAS : Extraction of common technologies (mesh, SOA, micro‑services) to build subsystems efficiently.
IAAS : Scaling services across multiple OS platforms using VM, Docker, Kubernetes to abstract the underlying OS.
3. Bounded Context
A bounded context (BC) represents a specific domain or module. The same concept (e.g., product) can have different meanings in different contexts such as order vs. inventory.
BCs relate to technology: multiple related BCs may be combined into a microservice, or a high‑traffic BC may be deployed as its own service.
Bounded‑Context Division Rules
First consider team size; too fine‑grained BCs increase operational overhead. Then evaluate semantic and functional relevance to decide granularity, finally obtaining multiple BCs.
4. Four‑Layer DDD Boundaries
1️⃣ Determine project vision, core, generic, and supporting sub‑domains. 2️⃣ The solution space’s bounded context forms a physical process isolation layer. 3️⃣ Within each bounded context, apply layered architecture: interface, domain, application, infrastructure. 4️⃣ Use aggregates in the domain layer to maintain model integrity.
5. Clean Layered Architecture
The clean layered approach separates interfaces from the domain layer, keeping domain logic independent of technical details and allowing easy replacement of infrastructure components.
6. Hexagonal Architecture
Active adapters handle input (UI, CLI) via controllers; passive adapters access external resources (databases, message queues). All adapters implement interfaces defined in the core, forming a polygon‑shaped architecture.
7. Onion Architecture
Extends hexagonal architecture by further separating the inner business logic into application services, domain services, and domain model layers. Characteristics: independent domain model, interface‑driven layers, inward‑directed dependencies, and infrastructure‑agnostic code.
8. Summary
Domain‑Driven Design is a popular architectural approach; by following its four‑layer boundaries you can achieve clear domain separation, facilitate vertical and horizontal scaling, and lay a solid foundation for future business and feature expansion.
Top Architect
Top Architect focuses on sharing practical architecture knowledge, covering enterprise, system, website, large‑scale distributed, and high‑availability architectures, plus architecture adjustments using internet technologies. We welcome idea‑driven, sharing‑oriented architects to exchange and learn together.
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.