SlideShare a Scribd company logo
1 of 74
Download to read offline
Patterns In Your PastryPatterns In Your Pastry
Image credit:Image credit: EvelynGiggles (EvelynIsHere)EvelynGiggles (EvelynIsHere) - http://www.flickr.com/photos/evelynishere/3662124836- http://www.flickr.com/photos/evelynishere/3662124836
James Watts
james.watts @ cakephp.org
CakeFest 2013: The CakePHP Conference
August 31st
, 2013 – San Francisco, USA
WARNINGWARNING
Image credit:Image credit: Vegan Feast Catering (VeganFeast)Vegan Feast Catering (VeganFeast) - http://www.flickr.com/photos/veganfeast/4139656092- http://www.flickr.com/photos/veganfeast/4139656092
WARNINGWARNING
You may feel hungryYou may feel hungry
at some point duringat some point during
this presentationthis presentation
Image credit:Image credit: Vegan Feast Catering (VeganFeast)Vegan Feast Catering (VeganFeast) - http://www.flickr.com/photos/veganfeast/4139656092- http://www.flickr.com/photos/veganfeast/4139656092
Design PatternsDesign Patterns
Image credit:Image credit: Andrew Michaels (dragontomato)Andrew Michaels (dragontomato) - http://www.flickr.com/photos/dragontomato/3050561189- http://www.flickr.com/photos/dragontomato/3050561189
There are many!There are many!
Image credit:Image credit: James Lee (jronaldlee)James Lee (jronaldlee) - http://www.flickr.com/photos/jronaldlee/7033839441- http://www.flickr.com/photos/jronaldlee/7033839441
Image source:Image source: AmazonAmazon - http://www.amazon.com/Design-Patterns-Elements-Reusable-Object-Oriented/dp/0201633612- http://www.amazon.com/Design-Patterns-Elements-Reusable-Object-Oriented/dp/0201633612
MVCMVC
Image credit:Image credit: Helen (afeitar)Helen (afeitar) - http://www.flickr.com/photos/afeitar/8039909030- http://www.flickr.com/photos/afeitar/8039909030
- M
- V
- C
- Model
- V
- C
- Model
- View
- C
- Model
- View
- Controller
- Business
- Presentation
- Mediation
- Business
- Presentation
- Mediation
- Business
- Presentation
- Mediation
“ separation of concerns ”
Neither layer . . .
Neither layer . . .
- wants to know
Neither layer . . .
- wants to know
- should know
Neither layer . . .
- wants to know
- should know
- or can know
Neither layer . . .
- wants to know
- should know
- or can know
about the other
Front ControllerFront Controller
Image credit:Image credit: Zrendavir_ (zrendavir)Zrendavir_ (zrendavir) - http://www.flickr.com/photos/zrendavir/3074941476- http://www.flickr.com/photos/zrendavir/3074941476
Single Point of Entry
Single Point of Entry
Obvious Jokes Omitted
Template MethodTemplate Method
Image credit:Image credit: Phil and Pam Gradwell (philandpam)Phil and Pam Gradwell (philandpam) - http://www.flickr.com/photos/philandpam/2195674013- http://www.flickr.com/photos/philandpam/2195674013
Override steps
Of a process
Without Modifying
The Process
“ Hooks “
FactoryFactory
Image credit:Image credit: Philippe Du Berger (DubyDub2009)Philippe Du Berger (DubyDub2009) - http://www.flickr.com/photos/urbexplo/4360787743- http://www.flickr.com/photos/urbexplo/4360787743
Create an Object
Without exposing
Instantiation logic
Animal
Animal
Cat
Animal Dog
Cat
Animal Dog
Cat
Moose
Animal Factory
Create ( 'dog' )
UtilityUtility
Image credit:Image credit: Kiran Foster (rueful)Kiran Foster (rueful) - http://www.flickr.com/photos/rueful/5697846897- http://www.flickr.com/photos/rueful/5697846897
Don't Require
Instantiation
Static
Active RecordActive Record
Image credit:Image credit: Marcin Wichary (mwichary)Marcin Wichary (mwichary) - http://www.flickr.com/photos/mwichary/2481681915- http://www.flickr.com/photos/mwichary/2481681915
ORM
ORM
Object Relational Mapping
Database Row = Object
Array
CRUD
CRUD
Create, Read, Update, Delete
DecoratorDecorator
Image credit:Image credit: U.S. Army Corps of Engineers (usacehq)U.S. Army Corps of Engineers (usacehq) - http://www.flickr.com/photos/usacehq/8723898265- http://www.flickr.com/photos/usacehq/8723898265
Add Behaviors
To an Object
Without Modifying
Other Instances
“ MIXIN “ OR “ TRAIT “
SingletonSingleton
Image credit:Image credit: Kevin Jones (kj-an)Kevin Jones (kj-an) - http://www.flickr.com/photos/kj-an/2294604279- http://www.flickr.com/photos/kj-an/2294604279
There can only be one
Only Allow a
Single Instance
StrategyStrategy
Image credit:Image credit: Lucas Arts/Walt DisneyLucas Arts/Walt Disney
Change a Process
Based on Criteria
Common Interface
Variable process
AdaptorAdaptor
Image credit:Image credit: gwire (gwire)gwire (gwire) - http://www.flickr.com/photos/gwire/336458831- http://www.flickr.com/photos/gwire/336458831
Adapts an Interface
Normalization
“ Wrapper ”
ObserverObserver
Image credit:Image credit: nociveglia (gwire)nociveglia (gwire) - http://www.flickr.com/photos/40385177@N07/4256525264- http://www.flickr.com/photos/40385177@N07/4256525264
Notifications
State Change
Event Driven
Patterns in your Pastry

More Related Content

What's hot (17)

TEDx Seattle 2013
TEDx Seattle 2013TEDx Seattle 2013
TEDx Seattle 2013
 
Researching in science
Researching in scienceResearching in science
Researching in science
 
L'alphabet
L'alphabetL'alphabet
L'alphabet
 
DevOps is Not Enough
DevOps is Not EnoughDevOps is Not Enough
DevOps is Not Enough
 
Edu Blogs
Edu BlogsEdu Blogs
Edu Blogs
 
Creative
CreativeCreative
Creative
 
Bilby report by Annabelle
Bilby report by AnnabelleBilby report by Annabelle
Bilby report by Annabelle
 
Random People
Random PeopleRandom People
Random People
 
Lets face it...
Lets face it...Lets face it...
Lets face it...
 
Child Soldiers
Child SoldiersChild Soldiers
Child Soldiers
 
Alex's Veterans' Issues Presentation, 7th period
Alex's Veterans' Issues Presentation, 7th periodAlex's Veterans' Issues Presentation, 7th period
Alex's Veterans' Issues Presentation, 7th period
 
The Social Media Conversation
The Social Media ConversationThe Social Media Conversation
The Social Media Conversation
 
Growing Grails Software, Driven by Domain
Growing Grails Software, Driven by DomainGrowing Grails Software, Driven by Domain
Growing Grails Software, Driven by Domain
 
Genocide in Rwanda Chandler
Genocide in Rwanda ChandlerGenocide in Rwanda Chandler
Genocide in Rwanda Chandler
 
Shauntee Issues in Africa 4th
Shauntee Issues in Africa 4thShauntee Issues in Africa 4th
Shauntee Issues in Africa 4th
 
Crohn's disease
Crohn's diseaseCrohn's disease
Crohn's disease
 
Words related to diseases
Words related to diseasesWords related to diseases
Words related to diseases
 

Viewers also liked (20)

PERTEMUAN KEDUA
PERTEMUAN KEDUAPERTEMUAN KEDUA
PERTEMUAN KEDUA
 
PERTEMUAN 1
PERTEMUAN 1PERTEMUAN 1
PERTEMUAN 1
 
Puff pastry
Puff pastryPuff pastry
Puff pastry
 
Puff pastry applications
Puff pastry applicationsPuff pastry applications
Puff pastry applications
 
Las plantas
Las plantasLas plantas
Las plantas
 
Daidjest dlya rieltorov_9_july_2016
Daidjest dlya rieltorov_9_july_2016Daidjest dlya rieltorov_9_july_2016
Daidjest dlya rieltorov_9_july_2016
 
Enterprise Cake
Enterprise CakeEnterprise Cake
Enterprise Cake
 
TDL EC eng
TDL EC engTDL EC eng
TDL EC eng
 
Development is a Piece of Cake
Development is a Piece of CakeDevelopment is a Piece of Cake
Development is a Piece of Cake
 
Katalog produk juknis dak bkkbn 2014
Katalog produk   juknis dak bkkbn 2014Katalog produk   juknis dak bkkbn 2014
Katalog produk juknis dak bkkbn 2014
 
TDL EC
TDL ECTDL EC
TDL EC
 
CakePHP Community Keynote 2013
CakePHP Community Keynote 2013CakePHP Community Keynote 2013
CakePHP Community Keynote 2013
 
Genre Kits BKKbN 2014 ~ PAKET PENYULUHAN GENRE KIT BKKBN 2014 ~ GenRe Kit BKK...
Genre Kits BKKbN 2014 ~ PAKET PENYULUHAN GENRE KIT BKKBN 2014 ~ GenRe Kit BKK...Genre Kits BKKbN 2014 ~ PAKET PENYULUHAN GENRE KIT BKKBN 2014 ~ GenRe Kit BKK...
Genre Kits BKKbN 2014 ~ PAKET PENYULUHAN GENRE KIT BKKBN 2014 ~ GenRe Kit BKK...
 
Funeraria
FunerariaFuneraria
Funeraria
 
Eje cafe
Eje cafeEje cafe
Eje cafe
 
Las planta
Las planta Las planta
Las planta
 
Daidjest dlya rieltorov_10_august_2016
Daidjest dlya rieltorov_10_august_2016Daidjest dlya rieltorov_10_august_2016
Daidjest dlya rieltorov_10_august_2016
 
Product and packaging
Product and packagingProduct and packaging
Product and packaging
 
Food safety-training-for-agencies-2012
Food safety-training-for-agencies-2012Food safety-training-for-agencies-2012
Food safety-training-for-agencies-2012
 
CakePHP Community Keynote 2014
CakePHP Community Keynote 2014CakePHP Community Keynote 2014
CakePHP Community Keynote 2014
 

Recently uploaded

ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Bhuvaneswari Subramani
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 

Recently uploaded (20)

ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 

Patterns in your Pastry