Chapter 22. ColdFusion Components

ColdFusion Components (CFCs) are new in ColdFusion MX. CFCs offer an additional way to encapsulate code beyond the capabilities provided by includes, user-defined functions, and custom tags. CFCs give you a framework for leveraging object-oriented principles and techniques to better organize and reuse your code. CFCs also serve as the primary interface for web services in ColdFusion MX, as well as for integration between Flash MX and ColdFusion MX via Flash Remoting.

In previous versions of ColdFusion, if you wanted to encapsulate your code, you basically had three options. You could put your code in a separate file and cfinclude it, you could write it as a UDF, or you could create a custom tag. Each technique had its advantages and disadvantages, as well as appropriate usages.

A CFC-based architecture offers several advantages over previous methods for developing ColdFusion applications. Because CFCs take an object-oriented approach to ColdFusion application development, they offer a formalized, structured framework for developing application functionality. This not only tends to make your ColdFusion code easier to read, but it also generally makes your code easier to maintain.

If you are at all hesitant about object-oriented programming, don’t be. A large chunk of what you need to know to work with CFCs, you already learned back in Chapter 20. In fact, user-defined functions serve as the basis for creating component methods, as you’ll learn shortly. ...

Get Programming ColdFusion MX, 2nd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.