Published on 09 June 2013 by @mathiasverraes
Data Mappers (like Doctrine2) help us a lot to persist data. Yet many projects are still struggling with tough questions: - Where to put business logic? - How to protect our code from abuse? - Where to put queries, and how test them?
Let’s look beyond the old Gang of Four design patterns, and take some clues from tactical Domain Driven Design. At the heart of our models, we can use Value Objects and Entities, with tightly defined consistency boundaries. Repositories abstract away the persistence. Encapsulated Operations helps us to protect invariants. And if we need to manage a lot of complexity, the Specification pattern helps us express business rules in the language of the business.
These patterns help us evolve from structural data models, to rich behavioral models. They capture not just state and relationships, but true meaning.
The presentation is a fast paced introduction to some patterns and ideas that will make your Domain Model expressive, unbreakable, and beautiful.
Check out Elephant in the Room #002: The Heart and Soul of OOP for more info about Value Objects.Follow @mathiasverraes on Twitter.
|Talk TBD||SweetlakePHP||Talk||Zoetermeer, NL||Feb 6|
|Experiencing Domain-Driven Design||Inviqa||Workshop||London, UK||April 22-24|
|Talk TBD||NCRAFTS||Talk||Paris, FR||May 21-22|
|Talk TBD||SOLIDay||Talk||Belgrade, RS||May 30|
|Decoupling the Model from the Framework||International PHP Conference||Talk||Berlin, DE||Jun 10-11|
|Extract Till You Drop||International PHP Conference||Talk||Berlin, DE||Jun 10-11|
|Experiencing Domain-Driven Design||Zilverline||Workshop||Amsterdam, NL||Jun29-Jul1|
|Experiencing Domain-Driven Design||3 day DDD training||Workshop||Ghent, BE||Aug 12-14|
|Experiencing Domain-Driven Design||3 day DDD training||Workshop||Berlin, DE||Aug 19-21|
This work by Mathias Verraes is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 License.