Domain-Driven Design (or DDD for short) is one of the most popular approaches to software development, and that's for a very good reason. As described excellently by Martin Fowler, it "is an approach to software development that centres the development on programming a domain model with a rich understanding of the processes and rules of a domain". Building software that way, especially when dealing with a complex domain, leads to aligned business people and developers and better software that does precisely what the business needs. Ever since its formal definition by Eric Evans all the way back in 2003, developers have used it to create software based on a well-developed model of design. In this Getting Started course, Amichai Mantinband will break down Domain-Driven Design into a very easily digestible concept using his real-world experience.
What is Domain-Driven Design?
What is a Domain?
Why you should learn and practice DDD
The two parts of DDD
The domain we’ll be exploring
The domain’s Ubiquitous Language
Ubiquitous Language as a tool for detecting Domain Objects
The domain’s invariants
Creating the domain objects
Invariants as Unit Tests
Enforcing Invariants that rely on dependencies
The Result Pattern
What are Tactical Patterns?
What is Tactical Design?
Implementing the Entity base class
Implementing the Value Object base class
Shifting the focus to Aggregates
Implementing the Aggregate base class
Structuring the Domain Layer around Aggregates
Implementing a Static Factory Method
Disconnected Domain Models
Repositories and EF Core
Implementing a Repository
Accessing the Domain Layer via a web API
A system without Domain Events
What is a Domain Event?
The Domain Event Sausage Factory
Implementing a Domain Event
Domain Model Identity Uniqueness
Domain Modeling & Analysis Paralysis
Domain Object Deletion
One Aggregate Per Transaction
Reference Between Domain Models
Application Services vs Domain Services
Transactional vs. Eventual Consistency
Rich vs. Anemic Domain Models
Always Valid vs. Not Always Valid
What is Strategic Design?
The 3 types of Sub-Domains
Context Mapping and Context Maps
Context Map example
Context Map Patterns
Bounded Contexts vs. Sub-Domains (Problem vs. Solution Space)
Exploring our Domain’s Bounded Contexts
Exploring relationships between our Bounded Contexts
Defining our Context Map
What are Integration Events?
The chain of Integration and Domain Events
Using a Message Broker for distributing Integration Events
Error handling when publishing Integration Events
The Outbox Pattern
The Integration Events Sausage Factory - Outbox Writer
The Integration Events Sausage Factory - Integration Event Publisher
The Integration Events Sausage Factory - Consuming Integration Events
Amichai Mantinband is a Software Engineer at Microsoft and a .NET content creator.
He works on large-scale, distributed systems within Microsoft Office, serving over 100 million daily users. He is a speaker at official .NET conferences, and within Microsoft, he authors and teaches software architecture courses.
Amichai is the author of NuGet packages ErrorOr & Throw and has a .NET programming YouTube channel covering advanced topics such as design patterns, architecture, and best practices.