8
What are the advantages of using the CQRS (Command/Query Responsibility Segregation) standard? What would be the disadvantages ?
8
What are the advantages of using the CQRS (Command/Query Responsibility Segregation) standard? What would be the disadvantages ?
3
In short, CQRS is useful and recommended in complex domain scenarios or high-performance applications.
Phrasing Microsoft documentation when compared to conventional CRUD model:
Compared to the single data model used in based systems in CRUD, the use of separate update and query templates for the data in CQRS-based systems simplifies design and implementation. However, one disadvantage is that, unlike CRUD projects, CQRS code cannot be generated automatically using mechanisms of scaffolding.
So one of the biggest advantages is improved performance in complex applications and one of the biggest drawbacks is the possible increase in complexity of the code that represents the model. However, CQRS is not recommended in all scenarios.
Recommended scenarios:
Scenarios not recommended:
In addition, according to Martin Fowler’s recommendations, the CQRS standard should be applied to parts of a system and not to it as a whole. Trying to implement this standard in a system whose complexity is not compatible will only considerably decrease the productivity and complexity of development. Also consider the team’s experience with DDD, as an immature team regarding the correct implementation of rich domains can be disastrous in trying to implement CQRS.
There is no difference between implementing this standard with. NET Core or other framework or language, the considerations on using (or not) are not limited to a technical issue.
Sources:
Microsoft documentation: https://docs.microsoft.com/pt-br/azure/architecture/patterns/cqrs
Martin Fowler: https://martinfowler.com/bliki/CQRS.html
Browser other questions tagged c# .net pattern-design
You are not signed in. Login or sign up in order to post.
Thanks for the excellent reply. It helped a lot :D
– Jonathan Barcela