presentation

26
Design Patterns and ColdFusion: Exploring Object Based Programming Dan Blackman www.muddbrick.com

Upload: zubin67

Post on 28-Jan-2015

489 views

Category:

Documents


0 download

DESCRIPTION

 

TRANSCRIPT

Page 1: Presentation

Design Patterns and ColdFusion: Exploring Object Based Programming

Dan Blackman

www.muddbrick.com

Page 2: Presentation

Dan Blackman

• Founder and Senior Consultant – – Mudd Brick Inc, Dallas, Tx

• Certified Adobe Instructor – Flex, ColdFusion, Flash

• Experience – 12 Years ColdFusion, Flash and Flex

Page 3: Presentation

Setting 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 today…Just demystification of a cryptic topic.

• Let’s have an interactive dialog

Page 4: Presentation

Objectives

• Design Patterns: The Why?• Identification of Core Design Patterns• Frameworks• Shut up and Show me some code!!!• Summary and Questions

Page 5: Presentation

Design Patterns: The Why!?

What is the main goal of building ColdFusion/ Flex Applications?

Page 6: Presentation

Design Patterns: The Why?

SOA –Service Oriented Architecture

Mind the Gap - Marcel Boucher

http://blogs.adobe.com/mtg/2008/04/implementing_soa_principals_in.html

Duane Nickul, et al

http://www.adobe.com/enterprise/pdfs/Services_Oriented_Architecture_from_Adobe.pdf

Page 7: Presentation

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."

Terry Borden and Bill Mitlehner

Page 8: Presentation

Design Patterns: The Why?

SOA

Page 9: Presentation

Design Patterns: The Why?

• FACT: Refactoring patterns into existing code is much more difficult than writing an application correctly the first time.

Page 10: Presentation

Design 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.

Page 11: Presentation

Design Patterns: The Why

Let’s look at some Spaghetti Code:Most of you have written code like this!!!

Page 12: Presentation

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

Page 13: Presentation

Identification of Core Design Patterns

What are design patterns and how do I use them?

Page 14: Presentation

Identification 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.

Page 15: Presentation

Identification 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

Page 16: Presentation

Identification of Core Design Patterns

Page 17: Presentation

Identification 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

Page 18: Presentation

Identification of Core Design Patterns

– Singleton Design Pattern

– Used to restrict the instantiation of a class to a single instance.

– Application.cfc - OnApplicationStart

Page 19: Presentation

Identification of Core Design Patterns

– Service Objects

• Allows Encapsulation of Business Logic in a single service interface.

• LoginService.cfc• EmailService.cfc• ZipValidationService.cfc

Page 20: Presentation

Identification 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

Page 21: Presentation

Identification 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.

Page 22: Presentation

Identification 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)

Page 23: Presentation

Identification 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

Page 24: Presentation

FrameworksVarious Frameworks implement design patterns:

ColdFusion• ColdBox• Mach-II• Model-Glue• ColdSpring

Flex• Pure MVC• Cairngorm• Model-Glue• Swiz• Mate

Page 25: Presentation

Shut 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!?

– Let’s check out a real scenario!

Page 26: Presentation

Questions?

Dan BlackmanMudd Brick Inc.

Dallas, [email protected]