Chapter 2. Effective Component Development
In this chapter, we will learn about the benefits of including attributes into our components, functions, and arguments within the ColdFusion component.
We will also cover the following topics:
Using the pseudo-constructor method to set variables
Whitespace suppression within the CFC
Returning data from your function
Access properties and restrictions
Documentation and introspection
Creating and reading metadata from the component
Pseudo-constructors
In Chapter 1, Introducing ColdFusion Components we looked at how to create an instance of a ColdFusion component using the createObject()
function. We also looked at how to pass values through to the instantiated object upon creation using the init()
method (also known as the object constructor method), thereby making them available to all methods within the CFC.
You can use any CFML tags or CFScript code within your component document to create your constructor code, and typically it is best practice to place...