Barney, Wait, isn't encapsulation the concept that the bean doesn't know anything about the outside world? Could you give me your definition... it seems to me it would be breaking something else... or I was given the wrong definition on that one. (And the bigger issue with this is CFC's don't have protection of attributes, thus I suggest they are only dangerous if the attribute could have a method by the same name. Isn't this also correct?)
Thanks, John Farrar -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Barney Boisvert Sent: Monday, August 29, 2005 1:04 PM To: [email protected] Subject: Re: [CFCDev] When to use the THIS scope for a ColdFusion Component? By and large, you don't need it. Putting variables in the 'this' scope breaks encapsulation, but there are two cases where you do need it: 1) <cfreturn this /> at the end of your init method, so the method returns a reference to the object as a constructor should. 2) for public constants. You can't actually enforce constants in CF, but it's still sometimes valuable to have "keys" that your object defines and which users of your component use as parameters, without ever knowing what the values of the keys are. This is a lot more common in fuller-featured languages like Java or C, because you can actually have constants (or final variables) that cannot be changed. cheers, barneyb On 8/29/05, wolf2k5 <[EMAIL PROTECTED]> wrote: > Hi all, > > I am new to OOP, but I know CFML pretty well. > > I started playing with ColdFusion Components a couple of years ago and > I never found a good reason to use the "This" scope. > > Am I missing anything? > > Thanks. > -- Barney Boisvert [EMAIL PROTECTED] 360.319.6145 http://www.barneyb.com/ Got Gmail? I have 50 invites. ---------------------------------------------------------- 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]
