Tackle Business Complexity in a Microservice with DDD and CQRS Patterns
Design a domain model for each microservice or Bounded Context that reflects understanding of the business domain.
This section focuses on more advanced microservices that you implement when you need to tackle complex subsystems, or microservices derived from the knowledge of domain experts with ever-changing business rules. The architecture patterns used in this section are based on domain-driven design (DDD) and Command and Query Responsibility Segregation (CQRS) approaches, as illustrated in Figure 7-1.
Figure 7-1. External microservice architecture versus internal architecture patterns for each microservice
However, most of the techniques for data driven microservices, such as how to implement an ASP.NET Core Web API service or how to expose Swagger metadata with Swashbuckle or NSwag, are also applicable to the more advanced microservices implemented internally with DDD patterns. This section is an extension of the previous sections, because most of the practices explained earlier also apply here or for any kind of microservice.
This section first provides details on the simplified CQRS patterns used in the eShopOnContainers reference application. Later, you will get an overview of the DDD techniques that enable you to find common patterns that you can reuse in your applications.
DDD is a large topic with a rich set of resources for learning. You can start with books like Domain-Driven Design by Eric Evans and additional materials from Vaughn Vernon, Jimmy Nilsson, Greg Young, Udi Dahan, Jimmy Bogard, and many other DDD/CQRS experts. But most of all you need to try to learn how to apply DDD techniques from the conversations, whiteboarding, and domain modeling sessions with the experts in your concrete business domain.
DDD (Domain-Driven Design)
Eric Evans. Domain Language
Martin Fowler. Domain-Driven Design
Jimmy Bogard. Strengthening your domain: a primer
Eric Evans. Domain-Driven Design: Tackling Complexity in the Heart of Software
Eric Evans. Domain-Driven Design Reference: Definitions and Pattern Summaries
Vaughn Vernon. Implementing Domain-Driven Design
Vaughn Vernon. Domain-Driven Design Distilled
Jimmy Nilsson. Applying Domain-Driven Design and Patterns
Cesar de la Torre. N-Layered Domain-Oriented Architecture Guide with .NET
Abel Avram and Floyd Marinescu. Domain-Driven Design Quickly
Scott Millett, Nick Tune - Patterns, Principles, and Practices of Domain-Driven Design
- Julie Lerman and Steve Smith. Domain-Driven Design Fundamentals
Send feedback about: