DDD Advanced Patterns

Patterns for applying Domain-Driven Design beyond the tactical basics, covering large-scale system organization, domain distillation strategies, and legacy modernization approaches. These complement the foundational DDD Building Blocks topic.

Prerequisites

This page assumes familiarity with:

Domain Distillation

Domain distillation is the strategic DDD practice of identifying which parts of your domain deserve the most investment.

Subdomain Classification

Subdomain TypeDescriptionInvestment Strategy
Core DomainWhat makes your business unique; competitive advantageDDD full investment; best developers
Supporting SubdomainNecessary for the business but not differentiatingDDD or simplified approach
Generic SubdomainStandard functionality (auth, payments, email)Buy off the shelf; open-source

Example (e-commerce):

  • Core: Recommendation engine, personalization, pricing strategy
  • Supporting: Order management, inventory tracking
  • Generic: Authentication, payment processing (Stripe), email (SendGrid)

Core Domain Focus

Applying DDD everywhere is wasteful. The Evans recommendation: focus DDD investment on the Core Domain — that’s where modeling quality makes a competitive difference. Supporting and generic subdomains can use Transaction Script or Active Record patterns.

Large-Scale Domain Organization

Responsibility Layers

For large domains where a single-level model becomes tangled, Evans’ Responsibility Layers pattern organizes the domain into horizontal strata:

See Responsibility Layers for details. Summary:

Decision Support  (route optimization, capacity planning)
     │
Commitments       (delivery promise to customer)
     │
Policies          (delivery policy constraints)
     │
Operations        (shipment schedule, current route)
     │
Capabilities      (vehicle fleet, driver availability)

Each layer only depends on layers below. Business intent (commitments) is separated from mechanism (capabilities).

Knowledge Level Pattern

The Knowledge Level provides a two-tier domain model where:

  • Base Level: Concrete operational instances (specific Employee, specific Policy)
  • Knowledge Level: Types and rules that govern base-level behavior (EmployeeType with allowed roles, PolicyType with coverage rules)

See Knowledge Level Pattern for details. Use when business rules about how objects behave change frequently and independently of the objects themselves.

Context Mapping at Scale

Context Maps document the relationships between Bounded Contexts. In large systems, managing context map relationships is a strategic concern:

Relationship Types

RelationshipDescriptionImplication
Shared KernelTwo teams share a subset of the modelHigh coordination cost; avoid unless necessary
Customer-SupplierSupplier plans for customer needsSupplier must be responsive to customer needs
ConformistDownstream conforms to upstream modelAccept translation cost or submit to upstream
Anti-Corruption LayerDownstream translates upstream’s modelProtects domain integrity; adds complexity
Open Host ServicePublish a protocol others integrate withStandard API; reduces integration friction
Published LanguageWell-documented shared languageEnables clean integration
Separate WaysNo integrationTeams independent; no shared functionality

DDD SLR finding: Context mapping is the most-used strategic DDD pattern in practice (Özkan et al., 2024) but also the most under-documented. Teams should maintain living context map diagrams.

Legacy Modernization with DDD

Eric Evans’ four strategies for applying DDD to legacy systems:

1. Bubble Context

Create a new, clean bounded context for new functionality. Wrap legacy with an Anti-Corruption Layer that translates. Legacy continues operating; new code is DDD.

2. Autonomous Bubble

More aggressive isolation: new bounded context communicates with legacy only through a strictly controlled ACL. New context can be developed without legacy knowledge.

3. Exposing Legacy as Services

Wrap legacy system with a service interface. Other contexts integrate via this service rather than directly. Enables gradual extraction.

4. Big Ball of Mud (Acknowledge Reality)

Sometimes the legacy system is so tangled that the pragmatic approach is to acknowledge it as a “Big Ball of Mud” and contain it — preventing it from contaminating new development while coexisting.

DDD in Microservices: Evidence from Research

The DDD Systematic Literature Review (Özkan et al., 2024 — 36 studies) found:

  • 44% of DDD studies focus on microservices decomposition (peaked 2021)
  • Key benefit: Bounded Contexts provide natural microservice boundaries
  • Key challenge: Learning curve (most cited barrier) and need for domain expert involvement
  • Evaluation gap: Only 39% of studies use empirical evaluation; most claims are anecdotal

Pattern: Use Event Storming to discover bounded context boundaries before committing to microservice decomposition. Premature decomposition is costly.