ColdFusion Components
Source: halhelms.com
Topic: Coldfusion Programming
Short Desciption:Equally extreme is the idea held by an impassioned few that with CFCs, Object Oriented (OO) programming has come to ColdFusion and will sweep away everything that has preceded it. [103] ColdFusion ...
Content Inside:
An Introduction to CFCs 1
2. An Introduction to
ColdFusion Components
[102] ColdFusion components (CFCs) have generated more discussion
than any other aspect of the newly released ColdFusion MX server.
On one end of the spectrum of opinion is the disparaging view of
some that CFCs are "nothing more" than structures with user-
defined functions (UDFs) attached. Equally extreme is the idea held
by an impassioned few that with CFCs, Object Oriented (OO)
programming has come to ColdFusion and will sweep away
everything that has preceded it.
[103] ColdFusion components have many similarities to objects in OO
languages, but they are still quite different. For now lets simply take
a look at them on their own terms, for however we may decide to
classify them, CFCs are extraordinarily useful.
Creating a Person CFC
[104] CFCs are particularly valuable in letting developers create a software
model for a category of things that exists in the world. That category
can either be tangible — persons, cars, buildings—or conceptual —
companies, tasks, agreements. Because concrete examples are
often easier to learn, lets start our exploration by creating a CFC
that models a person.
2 Discovering ColdFusion Components
[105] Start by creating a directory under your MX web root to hold some
example files. (Youll find it easiest if you create a directory structure
of com/techspedition/CFCs directly under your web root. This will
allow you to copy examples exactly as shown.)
[106] Create a file called Person.cfc
in the CFCs folder. (If you use
another directory structure, youll need to change the code
presented here to accommodate a different directory layout.)
[107] In your Person.cfc
file, add the <cfcomponent> tag in its barest of
forms:
<cfcomponent>
</cfcomponent>
[108] That code provides a container for all subsequent code related to
our Person CFC. Note that the tag has no ...

