THIS scope variables simply mean the variable is a public memory structure. Every CFC has a public memory structure. For the most part, these are either functions or variables spaces that can be accessed by a calling application.

A CFC itself defines an encapsulated memory structure. Its definition is a potential instance of an object. Encapsulation is a design decision. Data hiding is not encapsulation. The common technique for implementing data hiding is using getter and setter functions to access private variables. Getter and setters can be used to very effectively on public variables just as well as private variables. (See table wrapper CFC generated by CFSQLtool for practical examples.)

If an application has overloaded use of a CFC for data type changes, getter and setter are worth considering. Some examples of OO overstate encapsulation to include data hiding. Which is fine as long as the meaning is obvious. Data hiding may be useful when functions are overloaded.

Public variables are practical. For me, CFC public variables are very productive. Once a memory structure is instanced as an object, it's structure is well defined. Instances of public variables are easy to reference by simple assignment whereas to reference private variables requires get and set functions.

Some descriptions of "encapsulation" may better described as overloading. For example, a function that calculates price of gas can be overloaded with volume types of either gallons or liters.



-----------------------------------------------------------------------
http://www.switch-box.org/CFSQLTool/Download/

Switch_box                      MediaFirm, Inc.
www.Switch-box.org              Loveland, CO  USA



----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to 
[email protected] with the words 'unsubscribe cfcdev' as the subject of the 
email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting 
(www.cfxhosting.com).

CFCDev is supported by New Atlanta, makers of BlueDragon
http://www.newatlanta.com/products/bluedragon/index.cfm

An archive of the CFCDev list is available at 
www.mail-archive.com/[email protected]


Reply via email to