Implementing Design Patterns - PowerPoint PPT Presentation

1 / 16
About This Presentation
Title:

Implementing Design Patterns

Description:

MVC stands for Model View Controller. Source code in an application is ... 10 year old book by Eric Gamma, Richard Helm, Ralph Johnson and John Vlissides ... – PowerPoint PPT presentation

Number of Views:35
Avg rating:3.0/5.0
Slides: 17
Provided by: davef7
Category:

less

Transcript and Presenter's Notes

Title: Implementing Design Patterns


1
Implementing Design Patterns
  • With CFCs, MVC and other Design Patterns

2
What will this presentation cover
  • The MVC Design Pattern
  • Using MVC in Fusebox
  • Using MVC in Mach-II
  • Data Access Object Pattern
  • Abstract Factory Pattern
  • Facade Pattern
  • Decorator Pattern
  • Gateway Pattern

3
What is MVC
  • MVC stands for Model View Controller
  • Source code in an application is divided into
    three distinct parts
  • The Model is used to create a structure to store
    the data for the application
  • The View is the presentation later for the
    application
  • The controller handles the logic of the
    application

4
Fusebox and MVC
  • Fusebox is not a true Object Oriented Framework
  • Version 3 of Fusebox allows separation of view
    from the controller
  • Version 4 allows for full MVC without cfmoduling
  • This is accomplished by compiling the runtime
    files

5
Fusebox and MVC
  • Use circuits to set up MVC

ltfuseboxgt ltcircuitsgt ltcircuit alias"m"
path"model/" parent""/gt ltcircuit alias"v"
path"view/" parent""/gt ltcircuit alias"main"
path"controller/" parent""/gt lt/circuitsgt
6
Mach-II and MVC
  • Mach-II is an Object Oriented framework
  • Mach-II config file acts as a controller
  • Model is based on CFCs
  • Views are cfm templates

7
GoF Patterns
  • 10 year old book by Eric Gamma, Richard Helm,
    Ralph Johnson and John Vlissides
  • These patterns represent different designs that
    can be used in different Object Oriented
    applications
  • Examples are in C and Smalltalk
  • ISBN number 0-201-63361-2

8
Gang of Four
  • They divide patterns into three different groups
  • Creational Patterns
  • Structural Patterns
  • Behavioral Patterns

9
Data Access Object Pattern
  • Acts as a connector between CFC model and
    database, singleton
  • CFC based Objects are passed to DAO objects
  • DAOs handle basic CRUD functionality
  • Should use for single record operations
  • Query results should be handled with gateways

10
Data Access Object Pattern
  • ltcfset personDAOObj createObject(component,
    personDAO) /gt
  • ltcfset personObj createObject(component,
    person) /gt
  • ltcfset personObj.setPersonName(Dave) /gt
  • ltcfset personDAOObj.save(personObj) /gt

11
Abstract Factory Pattern
  • Used to create families of related and dependant
    Objects
  • Does not require specifying a concrete class
  • Do not need to use createObject() every time to
    create an object

12
Abstract Factory Pattern
  • personDAOObj appFactory.createDAO(person)
  • addressDAOObj appFactory.createDAO(address)
  • phoneDAOObj appFactory.createDAO(phone)

13
Session Façade Pattern
  • Allows for a unified interface to a set of
    interfaces in a subsystem
  • This is used to create a high level interface to
    make it easier to use lower level systems
  • Good example is the Bookstore shopping cart

14
Decorator Pattern
  • Add additional responsibilities to an object.
  • Gof example is a scrollbar for a text box
  • A Good CFC use would be to add functionality that
    does not exist for a model object. Person/Address
    relationship.
  • Provides an alternative to Subclassing

15
Gateway Pattern
  • Gateway Pattern should be used for exchanging
    data with common types, such as an query
  • Use gateway as a bridge between the object and a
    database
  • Encapsulate queries into objects

16
CFC Design Pattern Resources
  • http//www.corfield.org/blog/
  • http//clearsoftware.net/client/
  • http//www.mattwoodward.com/blog/
  • http//www.doughughes.net/
  • http//www.dcooper.org/blog/client/
  • http//www.briankotek.com
  • http//www.mossyblog.com/
Write a Comment
User Comments (0)
About PowerShow.com