On Saturday, Mar 29, 2003, at 23:42 US/Pacific, Scott Barnes wrote:
I have been researching the reasons for using private variables within a cfc vs using the public this.scope concept? I was wondering if anyone has any thoughts on this thus far?

It's all about tradeoffs. Using non-public instance variables provides better encapsulation and data integrity but requires more code to implement and a slightly more complex access mechanism.


Note that I say "non-public" - CFMX's instance variables are not private according to the generally accepted use of the term in OO languages, they are closer to Java's "protected".

One thing that a fellow CF`GERU dude mentioned was that people could bypass the setter/getter methods and go directly to manipulation of the 'object.property = ""' thus at the end of the objects save() to data layer, could become problematic (ie expecting a boolean value and they mispelled true with say trrue or something silly like that.

Yes, that is what I mean by "better encapsulation and data integrity".


Whats the peers of the community have to say on such a matter?

My personal view is that the goal should be encapsulated data - using set/get and non-public data. During the transition, as you start to use CFCs to add more structure to your applications and get used to the way they work, using "this" scope is simpler and may help you get up to speed with CFCs faster.


Sean A Corfield -- http://www.corfield.org/blog/

"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood

----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the word 'unsubscribe cfcdev' in the message of the email.


CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).

Reply via email to