Unbreakable Domain Models
summary
Data Mappers like Doctrine2 combine with Value Objects (Email, Money), Entities and collection-style Repositories to keep invariants: constructors require essential state, operations encapsulate lifecycle changes, and the Specification pattern exposes an S satisfiedBy plus optional asSql representation. Repositories implement a findSatisfying method that either filters objects in memory or dispatches the specification SQL, and queries get tested by comparing the in-memory filter result to the SQL result on a copy of production data. Used successfully across tenants with DI.
AI-written summary · about
chapters (7)
- 0:00Start
- 6:33Use objects as consistency boundaries
- 11:53Violates Single Responsibility Principle
- 15:43Encapsulate state and behavior with Value Objects
- 24:58Order 3 times to become a premium custom
- 28:17Different rules apply for different tenants.
- 32:37Use specifications to encapsulate rules about object selection
related talks
59mDoctrine ORM Good Practices and Tricks
54mFrom domain to code: a practical approach
54mHexagonal Architecture in DDD
27mConfessions of a Backend Developer
21mLaravel Doctrine: A Data Mapper Approach
37mBuilt to last: A domain-driven approach to beautiful systems
36mDomain Driven Design in Practice - a Java Perspective
54mImplementing Domain Driven Design
