Skip to content

Domain Driven Design

Domain-Driven Design (DDD) is an approach to software development that emphasizes the importance of understanding and modeling the business domain.

DDD Book

Outcomes

  • Shared understanding of the business domain
  • Clear and explicit models
  • Bounded contexts and distinct subdomains
  • Adaptability to change
  • Reduced complexity and technical debt

Bounded Contexts

Key Concepts

  1. Ubiquitous Language: Create a common, shared vocabulary that spans both business and technical domains. By sharing terminology across domains, teams can eliminate misunderstandings and ensure everyone involded has a clear understanding of the problem space.

  2. Bounded Contexts: Bounded Contexts are distinct, well-defined boundaries within which a particular model or set of terms apply. These boundaries help manage complexity by allowing different parts of the system to have their own models and terminologies without causing conflicts.

  3. Entities: Entities are objects within the domain that have a distinct identity and lifecycle. They represent concepts with long-lasting continuity and are typically modeled as objects in object-oriented programming languages. Entities encapsulate behavior and state, and they are responsible for maintaining consistency and enforcing business rules within the domain.

  4. Value Objects: Value Objects are objects within the domain that are defined by their attributes or values rather than their identity. They represent concepts that are immutable and interchangeable based on their value.

  5. Aggregates: Aggregates are clusters of related objects that form a single unit of consistency within the domain. They represent transactional boundaries and ensure that changes to the objects within the aggregate are performed in unison.

  6. Domain Events: Domain events represent significant occurrences or state changes within the domain. They capture important business activities or outcomes and are typically immutable and asynchronously communicated between different parts of the system.

  7. Domain Services: Domain Services encapsulate domain logic and behavior that doesn't naturally belong to any specific entity or value object. They represent operations or activities that involve multiple entities or have complex business rules.

  8. For more reference see: https://martinfowler.com/bliki/DomainDrivenDesign.html