Data in Read Models is expendable


Last Updated on Feb 01, 2021

CQRS and Event Sourcing patterns encourage keeping the queryable data sources of an application separate from the master data. Such queryable sources should remain flexible and non-critical to the application because Data in Read Models is expendable.

Read Models store ready-to-ship information, so they need to be in a format sent on the wire. They are created with the explicit purpose of addressing the needs of external systems or UI interfaces. Consequently, they are connected to high volatility systems and need to be restructured frequently to mirror the topical changes. Data in such formats is also not directly queryable.

Moreover, Read Models are best kept schemaless. In most document databases, the entire record is replaced on updates - partial updates are not possible. So it is easier to construct the denormalized form from scratch and replace the record than to partially update it.

The variability also means that Data in Read Models should not be treated as sacrosanct. When dealing with large changes resulting from business logic enhancements or UI tweaks, it is easier to build the newer version of the Read Model in the background from the original data source and switch to it appropriately.

For these reasons, developers should explicitly work with the assumption that Read Model data is expendable and incorporate the thought process right into the heart of the development lifecycle.


© 2022 Ambitious Systems. All Rights Reserved.