Description
Command Query Responsibility Segregation (CQRS) is an architectural pattern that separates reading and writing into two different models. Commands update data, and Queries read data.
Where to use
- High-traffic systems where reads vastly outnumber writes. \n
- Complex domains where read/write models differ.
Real World Example
A social network details profile updates (Commands) to a Normalized SQL DB, while the Feed (Query) is read from a Denormalized NoSQL store for speed.
Code Example
class CQRS:
def __init__(self):
pass
def execute(self):
print('Executing CQRS')
