You could wrap the array in some sort of collection object, ala the Java
Collections API? Although it does seem overkill for CF.
Brian Kotek wrote:
One glaring exception to this is when your getter returns an array.
For some insane reason that only the old time CF creators are aware
of, arrays are passed by value not by reference (unlike every other
complex data type). So you could do getSomeArray() in your CFC and
then do all sorts of fun stuff to the array, only to discover after
much exasperating debugging that the original array hasn't been
modified at all. So, for everything except arrays I use a getter, and
for arrays I either use the instance variable directly or manually set
the array using a setter after I am done with it. Annoying?
Absolutely. But unfortunately necessary.
On 10/12/05, *Dawson, Michael* <[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>> wrote:
I would say a best-practice would be to "always" use getters and
setters, even in your CFC. The only time you "should" access the
instance variables, directly, would be when you are actually
setting or
getting the variables from a client.
This leads to tighter encapsulation since you only have to write the
get/set logic once.
----------------------------------------------------------
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]
--
Haikal Saadh, Applications Programmer
Teaching and Learning Support Services
K405, Queensland University of Technology, Kelvin Grove Campus
[EMAIL PROTECTED], 3864 8633
CRICOS No. 00213J
----------------------------------------------------------
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]