2. Who Cares? “This time, it’s going to be different. Trust me.” “Doctor, it hurts when I do that.” Why?
3. A Question of Perspective Why are we doing this? It’s a “Best Practice”. The way it’s always been done.
4. A Few Problems UI Services / Caching Bottlenecks Caching Scalability Translation code Impedance mismatch Race conditions Stale data Business Logic DAL Database
6. Queries If it’s stale anyway… List of Customers ……………………. ……………………. ……………………. ……………………. ……………………. (from 10 minutes ago)
7. A Persistent View Model Read only. Stored in structure used by view. Query Persistent View Model SELECT * FROM Table WHERE ID = …
8. That’s Blasphemy! It’s the simplest thing that could possibly work. Testability? Maintainability? Security? Data already shown over the web. It’s already in your cache on the web tier. Role-based SELECTs.
9. Commands and User Input What is the user telling us? Do we even know? How? Task-based UIs vs. CRUD-based UIs. Capture user intent explicitly.
10. Validation and Business Rules Pre-validation from view model. Validation: Is this command complete? String lengths Required fields Regex, etc. Business Rules: Can I do what the user wants? Where is the source of truth?
13. Service Layer Transaction Script. Active Record / Table Module. Domain Model. No Getters/Setters Transactional. Separate database from queries. The “source of truth”.