Interesting article.

Encapsulation is the result of a process of discrimination. It is a declaration of something that is by discarding anything it is not. The article mentions defining the rules this illustrates discrimination. "Data hiding is indeed encapsulation" is true but encapsulation is data hiding is not true. Encapsulation is far more.

Private variables is data hiding is encapsulation dismisses public variables is class is encapsulation. Encapsulation is class is fact and behavior. Fact is variables of type public or private. Behavior is methods.

ISA statements are not exclusive and not a converse axiom. The statement "encapsulation is data hiding" is a red herring. Whereas, "data hiding is encapsulation" is mostly correct because it is not exclusive.

Back to the original question about using this scope variables in CF. The very fact that a CFC is defined, is a discrimination of all other facts and behaviors. Whether or not the discrimination is complete in the problem domain is another consideration. The use of pubic variables does not violate encapsulation, it only violates some opinions on how to implement encapsulation.

If using public variables satisfy the problem domain, most likely using them will be productive.

- - Part of the reason I published CFSQLTool under GNU was as comprehensive study on using public variables in data access layers. The table wrapper code wizards generate not only database queries but also form queries using the same public variables. Form queries and database queries can exist within the same class as a data access layer.


At 07:03 AM 8/31/2005, you wrote:
Data hiding is indeed encapsulation. There are may types of
encapsulation: data hiding, implementation, object creation, and
system design. NetObjectives has a very nice article on using
different types of encapsulation to identify patterns:

http://www.netobjectives.com/ezines/ez0508NetObj_IDPatternsTermsEncap.pdf

And just a note that you if you don't want to have to write getters
and setters for every property, you can still make the variables
private rather than public by creating a single get method that gets
any property: getProperty( 'firstName' ). This way you only have one
method, but external code can only change the properties if you allow
them to (by going through a setter).

Regards,

Brian

On 8/31/05, Joseph Flanigan <[EMAIL PROTECTED]> wrote:
> 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]
>
>
>


----------------------------------------------------------
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]

-----------------------------------------------------------------------
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