Object-Oriented Programming in ColdFusion

Object-Oriented Programming in ColdFusion
eBook: $23.99
Formats: PDF, PacktLib, ePub and Mobi formats
save 15%!
Print + free eBook + free PacktLib access to the book: $63.98    Print cover: $39.99
save 37%!
Free Shipping!
UK, US, Europe and selected countries in Asia.
Also available on:
Table of Contents
Sample Chapters
  • Fast-paced easy-to-follow guide introducing object-oriented programming for ColdFusion developers
  • Enhance your applications by building structured applications utilizing basic design patterns and object-oriented principles
  • Streamline your code base with reusable, modular objects
  • Packed with example code and useful snippets

Book Details

Language : English
Paperback : 192 pages [ 235mm x 191mm ]
Release Date : October 2010
ISBN : 1847196322
ISBN 13 : 9781847196323
Author(s) : Matt Gifford
Topics and Technologies : All Books, Web Development, AJAX

Table of Contents

Chapter 1: Introducing ColdFusion Components
Chapter 2: Effective Component Development
Chapter 3: Building Your First Bean
Chapter 4: Inheritance and Object-Oriented Concepts
Chapter 5: Data Access Objects
Chapter 6: Gateways
Chapter 7: Creating a Service Layer
  • Chapter 1: Introducing ColdFusion Components
    • Why use CFCs?
      • Grouping your functions
      • Organizing your components
    • The ColdFusion component tags
    • Our first component
      • Defining a method
      • Returning the data
        • ColdFusion 9 scripted components
      • Creating your object
    • Restricting your functions to scopes
      • Using arguments within your methods
      • The Arguments scope
      • Redefine the function parameters
      • Combining your methods
    • Protecting your local variables
      • Using the Var scope
        • Placing your Var scoped variables
        • Naming your Var scoped variables
    • Accessing your CFC
      • Instantiating the object
        • Using the createObject function
        • Using the cfobject tag
        • Using the NEW operator
      • Using cfinvoke
        • The cfinvoke tag
        • Using cfinvokeargument
        • Using attributes as arguments
        • Using an argument collection
    • Passing arguments into an instance method call
      • As a list
      • As named values
      • As an argumentCollection
    • Arguments in action
      • Merging your functions into one
      • Using cfargument to combine your methods
    • Creating an object constructor
      • Creating an init() function
      • The Variables scope
      • Calling your init() function
      • The This scope
    • Summary
  • Chapter 2: Effective Component Development
    • Pseudo-constructors
      • Using the pseudo method
      • Suppressing whitespace
        • Output attribute
      • Pseudo-constructor or init() method
    • Returning values and variables
      • returnType
    • Access properties
      • Private
      • Package
      • Public
      • Remote
    • Getting information about your CFC
      • Introspection
        • CFC Explorer
        • Component Doc
      • Document your code
        • Benefits of documentation
        • Displayname attribute
        • Hint attribute
        • Description attribute
        • User-defined metadata
      • Obtaining CFC metadata
        • getMetaData
        • getComponentMetaData
        • Returning metadata
    • Detailed introspection
    • Summary
  • Chapter 3: Building Your First Bean
    • What is a Bean?
      • But what is it really?
    • The benefit of using beans
    • Creating our first Bean
      • An introduction to UML
        • Person object in UML
      • What makes a Bean a Bean
        • A default/no-argument constructor
        • Easily accessible for introspection
      • Completing our Projects Bean
        • Calling our project Bean
    • Populating the Bean
      • Read/Write Bean
      • Read-only Bean
    • Helpful objects
    • Implicit accessors
    • Summary
  • Chapter 4: Inheritance and Object-Oriented Concepts
    • What is Inheritance?
      • Avoiding code duplication
      • Inheriting our products
      • The Super keyword
        • Overriding methods
      • Instantiating our products
    • The inheritance hierarchy
      • Specialization
      • The "IS A" relationship
    • Polymorphism
    • Composition
      • The "HAS A" Relationship
        • Implied ownership
    • Aggregation
    • Summary
  • Chapter 5: Data Access Objects
    • What is a Data Access Object?
    • Creating a Data Access Object
      • The create method
        • Storing a new user
      • The read method
        • Handling select results
      • The update method
      • The delete method
      • An alternative save method
        • The save method
        • The exists method
        • Caching the Data Access Objects
    • Dependency Injection
    • Summary
  • Chapter 6: Gateways
    • What is a Gateway?
    • A typical ColdFusion Gateway
      • Creating a Gateway object
        • Naming conventions
      • Adding gateway methods
      • Minimising code duplication
        • Revising the gateway object
        • Caching the Gateway object
    • The Gateway discussion
      • No hard and fast rules
      • Table Data Gateway
        • Similarities to Data Access Objects
        • Combining the two patterns
      • Which option is best?
    • Summary
  • Chapter 7: Creating a Service Layer
    • What is a Service Layer?
      • Facade patterns in a nutshell
    • Creating a service
      • Defining the User Service
        • Adding the CRUD methods
        • Adding the Gateway methods
      • Adding an abstract class
    • Defining the address service
      • onApplicationStart (revisited)
    • Summary

Matt Gifford

Matt officially began life as a developer in 2000, although he used to 'develop' simple applications using BASIC Programming on his Sinclair ZX Spectrum. After creating relational databases in VBScript and hand-coding HTML pages in text editors, the obvious route was to start developing websites using dynamic data.

He is now lead developer with Fuzzy Orange Ltd, and specializes in ColdFusion, Flex, and AIR development, and is also proud to be called an Adobe Community Professional for ColdFusion. He has spoken and presented regularly at national and international conferences and online meetings, and has written tutorials and articles for online resources and UK industry magazines.

Constantly striving to learn more and update any skill set he can, he loves to read development publications and community blogs, attend conferences, and discuss issues with other members of the development community.

A keen proponent for community resources and sharing knowledge, Matt writes and releases open-source ColdFusion applications and code samples as often as he can, and can also be seen updating resources and writing articles on his blog, http://www.mattgifford.co.uk.

Code Downloads

Download the code and support files for this book.

Submit Errata

Please let us know if you have found any errors not listed on this list by completing our errata submission form. Our editors will check them and add them to this list. Thank you.


- 2 submitted: last submission 12 Jun 2013

Errata type: Typo | Page number: 136

The following line is incomplete: "This description states that a Gateway object manages and handles access to"
This line can be ignored as the following paragraph explains what the line was trying to explain.


Errata type: Typo | Page number: 66

In the second paragraph under the subheading "A default/no-argument constructor," the first sentence reads "As such, we have set the required attribute for each argument to required="false",..."
required="false" should actually be "required="true"."

Sample chapters

You can view our sample chapters and prefaces of this title on PacktLib or download sample chapters in PDF format.

Frequently bought together

Object-Oriented Programming in ColdFusion +    Visualforce Development Cookbook =
50% Off
the second eBook
Price for both: €29.90

Buy both these recommended eBooks together and get 50% off the cheapest eBook.

What you will learn from this book

  • Make your ColdFusion Components (CFCs) come alive with methods, using object inheritance, connecting to a database through the internal methods of our object/CFCs
  • Create a Bean object, complete with accessors and mutators to set and retrieve properties in the object, including sample code for ColdFusion 9 script components
  • Optimize and encapsulate your functions to improve code portability
  • Introduce the Bean into ColdFusion object-oriented programming design patterns, discover the benefits of code inheritance and understand polymorphism
  • Persist objects in memory throughout your applications
  • Examples of OOP concepts and basic design patterns
  • Create a service layer or façade to interact with your objects

In Detail

Are you tired of procedural programming or is your extensive code base starting to become un-manageable? Breathe some new life into your code and improve your development skills with the basic concepts of object-oriented programming. Utilize objects, modular components, and design patterns to expand your skills and improve your ColdFusion applications. Packed with example code, and written in a friendly, easy-to-read style, this book is just what you need if you are serious about ColdFusion.

This book is a fast-paced tutorial to important ColdFusion object-oriented programming topics. It will give you clear, concise, and practical guidance to take you from the basics of ColdFusion to the skills that will make you a ColdFusion developer to be reckoned with. Don't be put off by jargon or complex diagrams; read and see how you can benefit from this book and extend your development skills in the process.

Using the practical examples within this guide, you will learn how to structure your applications and code, applying the fundamental basics of object-oriented programming to develop modular, reusable components that will scale easily with your application. You will learn the basic fundamental practices of object-oriented programming, from object creation and re-use, to Bean objects, service layers, Data Access objects, and sample design patterns to gain a better understanding of OOP using examples that can be altered and applied in your application. Complete with detailed code samples and snippets, and written in a friendly easy-to-follow style, you will be able to break free from writing purely procedural code and enhance your applications by building structured applications utilizing basic design patterns and object-oriented principles.

An introduction to object-oriented programming in ColdFusion


This book is a fast-paced tutorial to developing ColdFusion applications using an object-oriented programming approach. Complete with code examples that can be altered and applied to your application and careful explanations, this book will guide you through your first interaction with object-oriented programming within your ColdFusion applications.

Who this book is for

If you are a web developer wanting to implement object-oriented programming with ColdFusion, then this book is for you. If your goal is to get a good grounding in the basics of object-oriented programming concepts, this book is perfect for you. No prior knowledge of object-oriented programming is expected, but basic knowledge of ColdFusion development skills is assumed.

Code Download and Errata
Packt Anytime, Anywhere
Register Books
Print Upgrades
eBook Downloads
Video Support
Contact Us
Awards Voting Nominations Previous Winners
Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software