Patterns in your Pastry

1,848
-1

Published on

Talk on design patterns in CakePHP given at CakeFest 2013 in San Francisco, USA.

Published in: Technology, Economy & Finance
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,848
On Slideshare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
5
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Patterns in your Pastry

  1. 1. 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
  2. 2. 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
  3. 3. 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
  4. 4. 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
  5. 5. 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
  6. 6. 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
  7. 7. MVCMVC Image credit:Image credit: Helen (afeitar)Helen (afeitar) - http://www.flickr.com/photos/afeitar/8039909030- http://www.flickr.com/photos/afeitar/8039909030
  8. 8. - M - V - C
  9. 9. - Model - V - C
  10. 10. - Model - View - C
  11. 11. - Model - View - Controller
  12. 12. - Business - Presentation - Mediation
  13. 13. - Business - Presentation - Mediation
  14. 14. - Business - Presentation - Mediation “ separation of concerns ”
  15. 15. Neither layer . . .
  16. 16. Neither layer . . . - wants to know
  17. 17. Neither layer . . . - wants to know - should know
  18. 18. Neither layer . . . - wants to know - should know - or can know
  19. 19. Neither layer . . . - wants to know - should know - or can know about the other
  20. 20. 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
  21. 21. Single Point of Entry
  22. 22. Single Point of Entry Obvious Jokes Omitted
  23. 23. 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
  24. 24. Override steps Of a process
  25. 25. Without Modifying The Process
  26. 26. “ Hooks “
  27. 27. 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
  28. 28. Create an Object Without exposing Instantiation logic
  29. 29. Animal
  30. 30. Animal Cat
  31. 31. Animal Dog Cat
  32. 32. Animal Dog Cat Moose
  33. 33. Animal Factory
  34. 34. Create ( 'dog' )
  35. 35. 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
  36. 36. Don't Require Instantiation
  37. 37. Static
  38. 38. 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
  39. 39. ORM
  40. 40. ORM Object Relational Mapping
  41. 41. Database Row = Object
  42. 42. Array
  43. 43. CRUD
  44. 44. CRUD Create, Read, Update, Delete
  45. 45. 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
  46. 46. Add Behaviors To an Object
  47. 47. Without Modifying Other Instances
  48. 48. “ MIXIN “ OR “ TRAIT “
  49. 49. 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
  50. 50. There can only be one
  51. 51. Only Allow a Single Instance
  52. 52. StrategyStrategy Image credit:Image credit: Lucas Arts/Walt DisneyLucas Arts/Walt Disney
  53. 53. Change a Process Based on Criteria
  54. 54. Common Interface Variable process
  55. 55. AdaptorAdaptor Image credit:Image credit: gwire (gwire)gwire (gwire) - http://www.flickr.com/photos/gwire/336458831- http://www.flickr.com/photos/gwire/336458831
  56. 56. Adapts an Interface
  57. 57. Normalization
  58. 58. “ Wrapper ”
  59. 59. 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
  60. 60. Notifications
  61. 61. State Change
  62. 62. Event Driven
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×