Is there a better way? Reads and writes are different. Reads happen often and need to be fast Writes need to be transactional Architecture should reflect these differences. Separate read and write responsibilities.
Reads (Queries) Create a model used only for reads Structure data around the UI One “table” per view Persistent View Model Inherently denormalized Read-only Data retrieval is easy and fast SELECT * FROM CustomerSummaryView Scales cheaply
The world is not read-only The system needs to capture change Real world events User decisions Expose commands that change system state One-way Imperative Validated for correctness
Further Implications Few relationships in either model Why use a RDBMS? Event sourcing Scalability via messaging patterns Events have other uses 3rd Party Integration Real-time updates of clients CRUD based UI vs. Task based UI
More Information Yahoo DDD discussion group http://tech.groups.yahoo.com/group/domaindrivendesign/ UdiDahan’s website www.udidahan.com Greg Young Mark Nijhof http://elegantcode.com/author/mark-nijhof/