Skip to main content
Definition Website Computer and Technology

Domain-Driven Design

Subject: Computer and Technology noun /doʊˈmeɪn ˈdrɪv.ən dɪˈzaɪn/ 1 definition

  1. Definition (noun)

    Entry #269 · Updated

    Domain-Driven Design (DDD) is a software design methodology, formalized by Eric Evans, that aligns system architecture and code with the structure, rules, and terminology of the underlying business domain. Rather than organizing software primarily around database schemas or technical frameworks, developers and domain experts collaborate to establish a shared ubiquitous language that maps directly into domain models composed of entities, value objects, aggregates, and domain events. At a strategic level, DDD divides large systems into explicit bounded contexts linked by context maps and anti-corruption layers so models can evolve independently without semantic ambiguity. Its primary boundary and purpose lie in isolating core business invariants from infrastructure concerns in complex domains, whereas simpler CRUD applications rarely justify its modeling overhead.

    Common Forms

    • Strategic Design: Decomposes large problem spaces into core, supporting, and generic subdomains, isolating each model inside a bounded context and defining explicit integration contracts through context maps and anti-corruption layers.

    • Tactical Design: Models business behavior within a single bounded context using concrete code patterns—including entities, immutable value objects, consistency-enforcing aggregates, repositories, and domain services—to protect invariants.

    • Hexagonal and Onion Architecture: Isolates the domain layer at the center of an application behind abstract ports and repositories, ensuring databases, message brokers, and API controllers depend on the domain rather than coupling business rules to infrastructure.

    • Event-Driven and Event-Sourced DDD: Captures meaningful state changes as immutable domain events raised by aggregates, enabling loosely coupled synchronization across bounded contexts and supporting event sourcing or CQRS read projections.

    Example

    In a retail platform structured with DDD, the Sales bounded context enforces order pricing and discount invariants inside an Order aggregate root—validating applyDiscount(code, amount) against immutable Money value objects before committing to PostgreSQL—while the Shipping bounded context models the same order ID purely as a Shipment dispatch target. Once payment clears, Sales emits an OrderConfirmed JSON event to an Apache Kafka topic, which Shipping consumes through an anti-corruption layer to schedule parcel routing without sharing database tables or domain classes.