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