Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.



Published on

  • Login to see the comments

  • Be the first to like this


  1. 1. Design Patterns and ColdFusion: Exploring Object Based Programming <ul><li>Dan Blackman </li></ul><ul><li> </li></ul>
  2. 2. Dan Blackman <ul><li>Founder and Senior Consultant – </li></ul><ul><ul><li>Mudd Brick Inc, Dallas, Tx </li></ul></ul><ul><li>Certified Adobe Instructor – Flex, ColdFusion, Flash </li></ul><ul><li>Experience – 12 Years ColdFusion, Flash and Flex </li></ul>
  3. 3. Setting Expectations <ul><li>I am not a Architect but I play one on TV </li></ul><ul><li>My name does not end in Lehman, Forta, Majano etc. </li></ul><ul><li>There will be NO debate here today…Just demystification of a cryptic topic. </li></ul><ul><li>Let’s have an interactive dialog </li></ul>
  4. 4. Objectives <ul><li>Design Patterns: The Why? </li></ul><ul><li>Identification of Core Design Patterns </li></ul><ul><li>Frameworks </li></ul><ul><li>Shut up and Show me some code!!! </li></ul><ul><li>Summary and Questions </li></ul>
  5. 5. Design Patterns: The Why!? What is the main goal of building ColdFusion/ Flex Applications?
  6. 6. Design Patterns: The Why? SOA –Service Oriented Architecture Mind the Gap - Marcel Boucher Duane Nickul, et al
  7. 7. Design Patterns: The Why? SOA –Service Oriented Architecture The ultimate value of SOA is the ability to combine automated business services to create new market offerings that may reduce time-to-market and development costs.&quot; Terry Borden and Bill Mitlehner
  8. 8. Design Patterns: The Why? SOA
  9. 9. Design Patterns: The Why? <ul><li>FACT: Refactoring patterns into existing code is much more difficult than writing an application correctly the first time. </li></ul>
  10. 10. Design Patterns: The Why <ul><li>Scalability – Can your application support a large number of concurrent users? </li></ul><ul><li>Maintainability – the everyday fight we have with our inner-self and management. </li></ul><ul><li>Reusability – Break down your application into small chunks. Forces us to build structure into our applications. </li></ul>
  11. 11. Design Patterns: The Why Let’s look at some Spaghetti Code: Most of you have written code like this!!!
  12. 12. Design Patterns: The Why MORAL of the STORY? An Architect does not construct a building with out a blueprint, Why are YOU then, building applications without a solid foundation? Me
  13. 13. Identification of Core Design Patterns What are design patterns and how do I use them?
  14. 14. Identification of Core Design Patterns <ul><ul><li>Design Pattern Definition: </li></ul></ul><ul><ul><ul><li>design pattern is a general reusable solution to a </li></ul></ul></ul><ul><ul><ul><li>commonly occurring problem in software design. A </li></ul></ul></ul><ul><ul><ul><li>design pattern is not a finished design that can be </li></ul></ul></ul><ul><ul><ul><li>transformed directly into code. </li></ul></ul></ul><ul><ul><li>In short, design patterns provide a foundational blueprint for software development. </li></ul></ul><ul><ul><li>Patterns are NOT code, they are designs we apply to our application code. </li></ul></ul>
  15. 15. Identification of Core Design Patterns <ul><ul><li>Core Patterns: </li></ul></ul><ul><ul><ul><li>MVC Design Pattern </li></ul></ul></ul><ul><ul><ul><li>Singleton Pattern – Application.cfc </li></ul></ul></ul><ul><ul><ul><li>Service Object Pattern </li></ul></ul></ul><ul><ul><ul><li>Front Controller/ Command Patterns </li></ul></ul></ul><ul><ul><ul><li>Business Delegate Pattern </li></ul></ul></ul><ul><ul><ul><li>DAO/ Gateway Patterns </li></ul></ul></ul><ul><ul><ul><li>Value/ Data Transfer Object Pattern </li></ul></ul></ul>
  16. 16. Identification of Core Design Patterns
  17. 17. Identification of Core Design Patterns <ul><ul><li>Model – View – Controller </li></ul></ul><ul><ul><ul><li>Allows for a clear separation between User Interface Objects and the underlying data model </li></ul></ul></ul><ul><ul><ul><li>Elements of MVC include </li></ul></ul></ul><ul><ul><ul><ul><li>Model , which manages data elements and responds to queries </li></ul></ul></ul></ul><ul><ul><ul><li>about its state and to instructions to change its state </li></ul></ul></ul><ul><ul><ul><ul><li>View , which manages a rectangular area of the display and is </li></ul></ul></ul></ul><ul><ul><ul><ul><ul><li>responsible for presenting the data </li></ul></ul></ul></ul></ul><ul><ul><ul><ul><li>Controller , which handles events from the user and system that </li></ul></ul></ul></ul><ul><ul><ul><ul><ul><li>affect the model and view </li></ul></ul></ul></ul></ul><ul><ul><ul><li>These application components allow the separation of the following </li></ul></ul></ul><ul><ul><ul><ul><li>User interaction </li></ul></ul></ul></ul><ul><ul><ul><ul><li>Modeling of the external world (data) </li></ul></ul></ul></ul><ul><ul><ul><ul><li>Visual feedback to the user </li></ul></ul></ul></ul>
  18. 18. Identification of Core Design Patterns <ul><ul><li>Singleton Design Pattern </li></ul></ul><ul><ul><li>Used to restrict the instantiation of a class to a single instance. </li></ul></ul><ul><ul><li>Application.cfc - OnApplicationStart </li></ul></ul>
  19. 19. Identification of Core Design Patterns <ul><ul><li>Service Objects </li></ul></ul><ul><ul><ul><li>Allows Encapsulation of Business Logic in a single service interface. </li></ul></ul></ul><ul><ul><ul><li>LoginService.cfc </li></ul></ul></ul><ul><ul><ul><li>EmailService.cfc </li></ul></ul></ul><ul><ul><ul><li>ZipValidationService.cfc </li></ul></ul></ul>
  20. 20. Identification of Core Design Patterns <ul><ul><li>Front Controller/ Command Patterns </li></ul></ul><ul><ul><ul><li>The Front Controller is a single component created to handle all system requests. </li></ul></ul></ul><ul><ul><ul><li>Controls and coordinates processing of each user across multiple requests. </li></ul></ul></ul><ul><ul><ul><li>Employs Command (workers) in order to carry out requests. </li></ul></ul></ul><ul><ul><ul><li>Commands can be reused throughout the application across multiple Views </li></ul></ul></ul>
  21. 21. Identification of Core Design Patterns <ul><ul><li>Business Delegate Pattern </li></ul></ul><ul><ul><ul><li>A simple class that acts to create separation between the Presentation/ Web tier client (HTML/ RIA) and the business tier on the back-end. </li></ul></ul></ul><ul><ul><ul><li>Provides remote access from Web clients to important business tier services. </li></ul></ul></ul>
  22. 22. Identification of Core Design Patterns <ul><ul><li>DAO/ Gateway Patterns </li></ul></ul><ul><ul><ul><li>DAO – Data Access Object – Provides CRUD operation methods for specific business objects. </li></ul></ul></ul><ul><ul><ul><li>Table Data Gateway (Fowler) – Provides a similar set of data access methods. Commonly used in ColdFusion applications for bulk data access. (i.e. queries that return large data sets) </li></ul></ul></ul>
  23. 23. Identification of Core Design Patterns <ul><ul><li>Data Transfer / Value Objects </li></ul></ul><ul><ul><ul><li>Also called “beans”, this pattern provides a way to transfer data back and forth to the Web Client tier </li></ul></ul></ul><ul><ul><ul><li>Value Objects are NOT packaged exactly like Database tabels </li></ul></ul></ul><ul><ul><ul><li>Designed using a UML Class diagram </li></ul></ul></ul>
  24. 24. Frameworks <ul><ul><li>Various Frameworks implement design patterns: </li></ul></ul><ul><ul><li>ColdFusion </li></ul></ul><ul><ul><ul><li>ColdBox </li></ul></ul></ul><ul><ul><ul><li>Mach-II </li></ul></ul></ul><ul><ul><ul><li>Model-Glue </li></ul></ul></ul><ul><ul><ul><li>ColdSpring </li></ul></ul></ul><ul><ul><li>Flex </li></ul></ul><ul><ul><ul><li>Pure MVC </li></ul></ul></ul><ul><ul><ul><li>Cairngorm </li></ul></ul></ul><ul><ul><ul><li>Model-Glue </li></ul></ul></ul><ul><ul><ul><li>Swiz </li></ul></ul></ul><ul><ul><ul><li>Mate </li></ul></ul></ul>
  25. 25. Shut up and show me some code!!! <ul><ul><li>When building an application, where do you start? </li></ul></ul><ul><ul><li>View  Controller  Model? </li></ul></ul><ul><ul><li>Model  Controller  View </li></ul></ul><ul><ul><li>You have a database – Where do I go from here!? </li></ul></ul><ul><ul><li>Let’s check out a real scenario! </li></ul></ul>
  26. 26. Questions? Dan Blackman Mudd Brick Inc. Dallas, TX [email_address]