Understanding CQRS architecture - Part 1

Starting today, we embark on a comprehensive series of articles that delve into the CQRS architectures with a specific focus on their application in the realm of microservices architecture. We will incorporate C# code examples as needed; however, the main objective is to thoroughly understand the rationale behind the introduction of this pattern in the early 2010s.

Microservices are an architectural style that structures a software application as a collection of small, independent, and loosely coupled services. In a microservices architecture, the application is broken down into a set of independently deployable services, each representing a specific business capability. These services can be developed, deployed, and scaled independently, allowing for greater flexibility, maintainability, and scalability.

This approach to presenting microservices is recurrent across various blogs; however, in reality, it merely marks the outset of the narrative. In practice, organizing disparate services cohesively is a highly challenging undertaking that necessitates a profound comprehension of the business. Despite its complexity, this task is arguably the most crucial, and hence, it is referred to as organizing the domain into strategic designs. Once this strategic design is clearly defined and individual services have gained consensus from stakeholders, their implementation is streamlined, and each can adopt a different architectural style. These styles are the tactical patterns. For instance, we can build a CRUD application or implement more sophisticated policies among them.

Throughout this series, we will delve into a widely adopted tactical paradigm known as CQRS, whose objective is to distinctly separate requests for reading data from requests for modifying data. We will explore the implementation of CQRS in the context of Azure Functions for serverless architectures.

The following textbooks on this subject are timeless classic and deserve a place on the shelf of every developer. They extend beyond CQRS architecture and covers a myriad of expansive and general practical use cases.

Domain-Driven Design: Tackling Complexity in the Heart of Software (Evans)

Clean Architecture: A Craftsman's Guide to Software Structure and Design (Martin)

Without further ado and as usual, let's begin with a few prerequisites to correctly understand the underlying concepts. Continue here.