CQRS stands for Command and Query Responsibility Segregation. The term was introduced by Greg Young in 2010 to describe a pattern that advocates for clear code separation between the state mutation and data retrieval. If we imagine a traditional layered architecture, CQRS slices our core application logic vertically, creating two models: one used for reads and the other used for writes.
When compared to CRUD, Read operations map to Queries, while Create, Update and Delete operations are replaced by Commands.
In its strict definition: a command is not data centric. It is not about creating, updating or deleting a single record on our database. A Command represents the intention to perform a task. It maps more closely to a complex business operation like generating an invoice, booking a hotel room, or provisioning a bare metal server.
CQRS can also help satisfy high performance and scalability requirements, especially when combined with a microservices architecture and asynchronous processing.
Greg Young himself describes CQRS more as a stepping stone towards event sourcing. It was a way to facilitate the necessary mental model switch that is required when working with an append only event log. If you are interested in the topic, you can watch the original clip [ Ссылка ]
🤓 There's more on my website! (articles, scripts, code snippets, etc...): 🤓
[ Ссылка ]
🤝 Connect with me: 🤝
[ Ссылка ]
👌Get a CodeCrafter Discount 👌
[ Ссылка ]
#systemdesign #softwarearchitecture #softwaredevelopment
Ещё видео!