When to use the CQRS design pattern?
The CQRS architecture pattern could be used when it is difficult to query from repositories all the data that users need to view. This is especially true when UX design creates views of data that cuts across several aggregate types and instances. The more sophisticated your domain, the more this tends to be true.
When it is unsuitable to compromise on UX design, using CQRS attempts to mitigate the problems associated with other solutions, such as:
- requiring clients to use multiple repositories to retrieve all aggregate instances; or
- the design of specialized finders on various repositories to gather disjointed data using a single query.
To summarize: Use CQRS when its difficult to query from repositories data users need to view, which tend to happen the more sophisticated your domain is.