the secret recipe of a juicy m
DESCRIPTION
Most Ms are stale and tasteless - and that although they are probably the most important ingredient of a tasty MVC implementation. This session is about the underestimated role of the M and how to create meaningful and clean Domain Models using Domain-Driven Design (a practical approach for creating clean apps for complex domains, independent from a specific technology). Bring your own apron.TRANSCRIPT
![Page 1: The Secret Recipe of a Juicy M](https://reader033.vdocuments.us/reader033/viewer/2022060110/555a8ce8d8b42a991b8b4652/html5/thumbnails/1.jpg)
International PHP Conference 2010, Mainz
Robert Lemke
The Secret Recipe for a Juicy M
Montag, 11. Oktober 2010
![Page 2: The Secret Recipe of a Juicy M](https://reader033.vdocuments.us/reader033/viewer/2022060110/555a8ce8d8b42a991b8b4652/html5/thumbnails/2.jpg)
Robert Lemkechief architect of TYPO3 Phoenix and FLOW3
co-founder of the TYPO3 Association
34 years old
lives in Lübeck, Germany
1 wife, 1 daughter, 1 espresso machine
likes drumming
Montag, 11. Oktober 2010
![Page 3: The Secret Recipe of a Juicy M](https://reader033.vdocuments.us/reader033/viewer/2022060110/555a8ce8d8b42a991b8b4652/html5/thumbnails/3.jpg)
= PHP 5.3 Full Stack Application Framework
Montag, 11. Oktober 2010
![Page 4: The Secret Recipe of a Juicy M](https://reader033.vdocuments.us/reader033/viewer/2022060110/555a8ce8d8b42a991b8b4652/html5/thumbnails/4.jpg)
The Secret Recipe for a Juicy M International PHP Conference 2010, Mainz
The FLOW3 ExperienceFlow [flō] The mental state of operation in which the person is fully immersed in what he or she is doing by a feeling of energized focus, full involvement, and success in the process of the activity. Proposed by positive psychologist Mihály Csíkszentmihályi, the concept has been widely referenced across a variety of fields.
FLOW3 [flō'three] The application framework which takes care of all hassle and lets you play the fun part.
Montag, 11. Oktober 2010
![Page 5: The Secret Recipe of a Juicy M](https://reader033.vdocuments.us/reader033/viewer/2022060110/555a8ce8d8b42a991b8b4652/html5/thumbnails/5.jpg)
OOP Object-Oriented Programming
AOP Aspect-Oriented Programming
MVC Model View Controller
POPO Plain Old PHP Object
DI Dependency Injection DRY
YAGNI
CoC
TDD
YAA
DDD Domain-Driven Design
Montag, 11. Oktober 2010
![Page 6: The Secret Recipe of a Juicy M](https://reader033.vdocuments.us/reader033/viewer/2022060110/555a8ce8d8b42a991b8b4652/html5/thumbnails/6.jpg)
The Secret Recipe for a Juicy M International PHP Conference 2010, Mainz
Domain-Driven Design
lightblue.com
Lorem Ipsum id solum civibus definitionem usu, ex elit contentiones ius. Lorem his quando facilisis efficiantur cu, delenit laboramus eos id, nec lorem invidunt te. Suas aliquid consequuntur ne mei, cu qui dicit graeco timeam. Ad assum decore definitiones ius, has dicat aliquip vocibus te, at per velit viderer legimus. Per no
DomainDesign
Montag, 11. Oktober 2010
![Page 7: The Secret Recipe of a Juicy M](https://reader033.vdocuments.us/reader033/viewer/2022060110/555a8ce8d8b42a991b8b4652/html5/thumbnails/7.jpg)
The Secret Recipe for a Juicy M International PHP Conference 2010, Mainz
Domain: The activity or business of the user
Montag, 11. Oktober 2010
![Page 8: The Secret Recipe of a Juicy M](https://reader033.vdocuments.us/reader033/viewer/2022060110/555a8ce8d8b42a991b8b4652/html5/thumbnails/8.jpg)
The Secret Recipe for a Juicy M International PHP Conference 2010, Mainz
GoalTo solve real problems of a real domain
Montag, 11. Oktober 2010
![Page 9: The Secret Recipe of a Juicy M](https://reader033.vdocuments.us/reader033/viewer/2022060110/555a8ce8d8b42a991b8b4652/html5/thumbnails/9.jpg)
The Secret Recipe for a Juicy M International PHP Conference 2010, Mainz
Domain-Driven Design
Montag, 11. Oktober 2010
![Page 10: The Secret Recipe of a Juicy M](https://reader033.vdocuments.us/reader033/viewer/2022060110/555a8ce8d8b42a991b8b4652/html5/thumbnails/10.jpg)
The Secret Recipe for a Juicy M International PHP Conference 2010, Mainz
Domain-Driven Designfocus on the domain and domain logic
Montag, 11. Oktober 2010
![Page 11: The Secret Recipe of a Juicy M](https://reader033.vdocuments.us/reader033/viewer/2022060110/555a8ce8d8b42a991b8b4652/html5/thumbnails/11.jpg)
The Secret Recipe for a Juicy M International PHP Conference 2010, Mainz
Domain-Driven Designfocus on the domain and domain logic
accurately map the domain concepts to software
Montag, 11. Oktober 2010
![Page 12: The Secret Recipe of a Juicy M](https://reader033.vdocuments.us/reader033/viewer/2022060110/555a8ce8d8b42a991b8b4652/html5/thumbnails/12.jpg)
The Secret Recipe for a Juicy M International PHP Conference 2010, Mainz
Domain-Driven Designfocus on the domain and domain logic
accurately map the domain concepts to software
form a ubiquitous language among the project members
Montag, 11. Oktober 2010
![Page 13: The Secret Recipe of a Juicy M](https://reader033.vdocuments.us/reader033/viewer/2022060110/555a8ce8d8b42a991b8b4652/html5/thumbnails/13.jpg)
Montag, 11. Oktober 2010
![Page 14: The Secret Recipe of a Juicy M](https://reader033.vdocuments.us/reader033/viewer/2022060110/555a8ce8d8b42a991b8b4652/html5/thumbnails/14.jpg)
The Secret Recipe for a Juicy M International PHP Conference 2010, Mainz
Ubiquitous languagea common vocabulary: important prerequisite for successful collaboration
use same words for
discussionmodelingdevelopmentdocumentation
class FlagshipStore {
...
public function isProfitable() { return ($this->earnings > ($this->expenses + $this->safetyMargin); }
...
Montag, 11. Oktober 2010
![Page 15: The Secret Recipe of a Juicy M](https://reader033.vdocuments.us/reader033/viewer/2022060110/555a8ce8d8b42a991b8b4652/html5/thumbnails/15.jpg)
The Secret Recipe for a Juicy M International PHP Conference 2010, Mainz
Layered Architecture
Presentation
Domain
Data source
Application Logic
Domain Model
View
Controller
Data Mapper (Persistence)
Data Source Abstraction
Montag, 11. Oktober 2010
![Page 16: The Secret Recipe of a Juicy M](https://reader033.vdocuments.us/reader033/viewer/2022060110/555a8ce8d8b42a991b8b4652/html5/thumbnails/16.jpg)
Montag, 11. Oktober 2010
![Page 17: The Secret Recipe of a Juicy M](https://reader033.vdocuments.us/reader033/viewer/2022060110/555a8ce8d8b42a991b8b4652/html5/thumbnails/17.jpg)
Montag, 11. Oktober 2010
![Page 18: The Secret Recipe of a Juicy M](https://reader033.vdocuments.us/reader033/viewer/2022060110/555a8ce8d8b42a991b8b4652/html5/thumbnails/18.jpg)
Montag, 11. Oktober 2010
![Page 19: The Secret Recipe of a Juicy M](https://reader033.vdocuments.us/reader033/viewer/2022060110/555a8ce8d8b42a991b8b4652/html5/thumbnails/19.jpg)
Montag, 11. Oktober 2010
![Page 20: The Secret Recipe of a Juicy M](https://reader033.vdocuments.us/reader033/viewer/2022060110/555a8ce8d8b42a991b8b4652/html5/thumbnails/20.jpg)
Montag, 11. Oktober 2010
![Page 21: The Secret Recipe of a Juicy M](https://reader033.vdocuments.us/reader033/viewer/2022060110/555a8ce8d8b42a991b8b4652/html5/thumbnails/21.jpg)
The Secret Recipe for a Juicy M International PHP Conference 2010, Mainz
DDD Building Blocks
Entity Value Object
Aggregate
ServiceFactory
Repository
Montag, 11. Oktober 2010
![Page 22: The Secret Recipe of a Juicy M](https://reader033.vdocuments.us/reader033/viewer/2022060110/555a8ce8d8b42a991b8b4652/html5/thumbnails/22.jpg)
The Secret Recipe for a Juicy M International PHP Conference 2010, Mainz
Defined by its identity (instead of its properties)
Examples: Participant, Blog Post
(you probably used artificial keys like a UUID for identifying entities in a database table)
Entity
Montag, 11. Oktober 2010
![Page 23: The Secret Recipe of a Juicy M](https://reader033.vdocuments.us/reader033/viewer/2022060110/555a8ce8d8b42a991b8b4652/html5/thumbnails/23.jpg)
The Secret Recipe for a Juicy M International PHP Conference 2010, Mainz
Defined by its value
Immutable
Examples: Color, Tag
Green
Pantone 354cR: 105 / G: 165 / B: 80#69A550
Value Object
#IPC10
Montag, 11. Oktober 2010
![Page 24: The Secret Recipe of a Juicy M](https://reader033.vdocuments.us/reader033/viewer/2022060110/555a8ce8d8b42a991b8b4652/html5/thumbnails/24.jpg)
The Secret Recipe for a Juicy M International PHP Conference 2010, Mainz
Actions within the domain which can'tbe implemted by entities and value objectsalone
Services should be stateless
Example: "Postpone Conference Service"
Service
Montag, 11. Oktober 2010
![Page 25: The Secret Recipe of a Juicy M](https://reader033.vdocuments.us/reader033/viewer/2022060110/555a8ce8d8b42a991b8b4652/html5/thumbnails/25.jpg)
The Secret Recipe for a Juicy M International PHP Conference 2010, Mainz
Compound of Entities and Value Objects
Entity is Aggregate Root
No direct references to objects inside theAggregate from outside
Reduces complexity
Examples: Speaker Profile, Blog Post, Car ...
Aggregate
Montag, 11. Oktober 2010
![Page 26: The Secret Recipe of a Juicy M](https://reader033.vdocuments.us/reader033/viewer/2022060110/555a8ce8d8b42a991b8b4652/html5/thumbnails/26.jpg)
The Secret Recipe for a Juicy M International PHP Conference 2010, Mainz
a.k.a. "where you keep things"
connection between clean domainand dirty data storage
provides query methods forretrieving domain objects
Repository
Montag, 11. Oktober 2010
![Page 27: The Secret Recipe of a Juicy M](https://reader033.vdocuments.us/reader033/viewer/2022060110/555a8ce8d8b42a991b8b4652/html5/thumbnails/27.jpg)
The Secret Recipe for a Juicy M International PHP Conference 2010, MainzMontag, 11. Oktober 2010
![Page 28: The Secret Recipe of a Juicy M](https://reader033.vdocuments.us/reader033/viewer/2022060110/555a8ce8d8b42a991b8b4652/html5/thumbnails/28.jpg)
The Secret Recipe for a Juicy M International PHP Conference 2010, MainzMontag, 11. Oktober 2010
![Page 29: The Secret Recipe of a Juicy M](https://reader033.vdocuments.us/reader033/viewer/2022060110/555a8ce8d8b42a991b8b4652/html5/thumbnails/29.jpg)
The Secret Recipe for a Juicy M International PHP Conference 2010, Mainz
Further ReadingFLOW3 Websitehttp://flow3.typo3.org
FLOW3 Downloadhttp://flow3.typo3.org/downloadgit://git.typo3.org/FLOW3/Distributions/Base.git
TYPO3 Forgehttp://forge.typo3.org
Further Readinghttp://flow3.typo3.org/about/principles/further-reading
Montag, 11. Oktober 2010
![Page 30: The Secret Recipe of a Juicy M](https://reader033.vdocuments.us/reader033/viewer/2022060110/555a8ce8d8b42a991b8b4652/html5/thumbnails/30.jpg)
The Secret Recipe for a Juicy M International PHP Conference 2010, Mainz
Questions
Email: [email protected]: http://robertlemke.de/blogTwitter: @t3rob
Slides: http://slideshare.net/rlmpFeedback: http://joind.in/talk/view/2182
Montag, 11. Oktober 2010
![Page 31: The Secret Recipe of a Juicy M](https://reader033.vdocuments.us/reader033/viewer/2022060110/555a8ce8d8b42a991b8b4652/html5/thumbnails/31.jpg)
Montag, 11. Oktober 2010