Design pattern Training in Andheri Mumbai (Lesson learn CQRS).

We continuously conduct Design pattern training in Mumbai, we also have one on this coming Saturday and Sunday. In past design pattern training we were asked lot of times about CQRS architecture pattern. So this week we had added this also as the part of the course.

So in this article let us take a quick look in to this pattern. Please note as I have said it’s a QUICK LOOK we will not be showing any code at this moment.

If you look around you will find developers using layered architecture approach. In this approach they divide the project in to atleast three layers UserInterface, Model and Data layer.

Normally developers try to use the same model for read and write purpose.


Now this model is normally driven from real world domain. For example let’s say you have a project where you have customer, customer can have a multiple addresses and every address can have phones.

So most probably you would end up in to a model which has 1 to many relationship as shown in the below figure. In short you will three classes with aggregation or composition relationship.


Now this model is good for writing / inserting in to database. But if we want to load huge amount of records in to this kind of hierarchical model it would not be a good idea. We would probably love to see a single flat class which has all properties from customer, address and phone.

In simple words “Reading” data is a very different ball game as compared to “Writing”data.

So what CQRS says separate these concerns in to different buckets.

“Create one model structure for write and a different model structure for read”.


Do not forget to watch our youtube video on Learn design pattern step by step using a project.



This entry was posted in Class Room Training, CQRS Design Pattern, Design pattern training and tagged , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *