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]


Reply via email to