I really enjoyed watching this video on domains and command/query separation:
Here are the short quotes that had the greatest meaning to me:
- State transitions are an important part of our problem space and should be modeled within our domain.
- My thoughts: instead of an application being data-driven, and application becomes scenario- or use case-driven.
- You know your audits are complete if you can rebuild your current state exactly and solely from the audit.
- Entities can be represented in the traditional way, or as a series of events that happened.
- Greg mentioned “rolling snapshots” as an answer to the obvious, “what about performance” question.
- Separate the Create, Update and Delete from the Restore.
- “A single model cannot be appropriate for reporting, searching, and transactional behaviors.”
- My thoughts: I have certainly experienced these tradeoffs: designs I’ve chosen to make the transactional behavior easier often result in it being more difficult to report and search on that data.
- Clients need data in a model that’s different than the domain model.
- Queries should query data directly rather than through the domain. This eliminates the need for domain entities to be so full of getters and setters.
- Have a reporting server. By the way, all queries are reports.