Skip to content

About the Read domain

Overview

The View domain within the architecture serves the primary function of providing optimized and tailored data access for querying purposes. It complements the write operations handled by the Command domain by offering a structured approach to retrieving and presenting data from the system. This separation ensures that querying operations do not impact the integrity or performance of the write operations, facilitating efficient data retrieval and presentation.

Key Concepts

  • Projection of Truth: Views in the architecture are designed to project the truth of the system's state into optimized read models. While the command side focuses on recording domain events and maintaining the system's state, the view side is concerned with interpreting this state for query purposes.

  • Materialized Views: These are pre-computed views optimized for specific querying needs. Materialized views store aggregated or transformed data in a way that enhances query performance, enabling faster retrieval compared to recalculating data on the fly.

  • Decoupling of Models: The View domain decouples the read model from the write model. This separation allows flexibility in how data is structured and queried, accommodating different perspectives and needs without affecting the core data integrity.

Functional Aspects

  • Query Execution: Views facilitate efficient querying by providing access to materialized views and optimized data structures. This capability supports complex querying scenarios, including aggregations, filtering, and combining data from different sources.

  • Functional Keys: Unlike technical keys used in the write model, views often employ functional keys that can evolve over time to meet changing business requirements. This flexibility allows the system to adapt to new data access patterns without disrupting existing operations.

  • Just in time Projection: The core concept of a projection involves dynamically transforming and combining data from various sources, such as materialized views and user inputs, to generate specialized views in real-time. Projections facilitate tasks like aggregating multiple materialized views, applying advanced filters based on user criteria, and performing calculations using both user-provided data and precomputed views. This dynamic approach enables responsive and flexible querying, ensuring that applications can deliver tailored data views efficiently without relying solely on precomputed results.

Benefits

  • Performance Optimization: By pre-computing and optimizing data for specific queries, views enhance overall system performance by reducing query latency and resource consumption.

  • Flexibility and Adaptability: The decoupling of read and write models allows for independent evolution of data access patterns and query optimizations, ensuring that the system can adapt to new requirements without extensive refactoring.

  • Improved Scalability: Separating read operations from write operations improves scalability by distributing the workload more efficiently across different components or services. Our implementation relies on AWS AppSync to

Conclusion

In conclusion, the View domain plays a crucial role in the architecture by providing efficient, optimized, and flexible data access for querying purposes. By leveraging materialized views, decoupled models, and optimized query execution, the View domain ensures that querying operations are performant, scalable, and adaptable to evolving business needs.