Not really.

A central aspect of OO, as you probably know, is encapsulation. Simply put,
it means that what you do within an object should not affect anything else
in your code, and the rest of your code should not affect the object. Using
variables scope within a OO CFC (rather than this scope) ensures that your
CFC/object is encapsulated. At first it might seem strange, like there are
all these walls in the way of what you want to do, because someone coming
from a procedural background will be used to having all their variables
available everywhere. Once you figure out how to keep your objects
encapsulated and discipline yourself to do so, later on down the line you'll
find your applications are much easier to modify - and do really cool things
with.

Now in ColdFusion, there are other ways you can break encapsulation besides
with the this scope. Request, session, and application scopes can be read
from within a CFC. You'll find OO converts here saying not to do that, to
pass the arguments in that you need, even if they are available to the CFC
via request, session or application scope. As an OO convert who had to learn
everything the hard way, I totally agree. Why? Because your architecture
will wind up being an object oriented architecture instead of a procedural
architecture with a little bit of OO constructs mixed in. It's a huge
difference, even if your OO architecture is a beginner's one.

My impression is that this difference is easy to miss if one's experiments
with OO turn out to be basically procedural with a few OO constucts. I had a
hard time keeping everything encapsulated in the beginning - i just wasn't
used to doing things that way. It was a struggle (and sometimes still is) to
get the architecture right in my object models. But i've found it very
worthwhile.

So in an OO sense, my impression is that one can miss something important if
you don't catch hold of the core tenet of encapsulation and learn to follow
thru in your code.

:) nando


> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Behalf Of wolf2k5
> Sent: Monday, August 29, 2005 6:29 PM
> To: [email protected]; [email protected]
> Subject: [CFCDev] When to use the THIS scope for a ColdFusion Component?
>
>
> 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.
>
>
> ----------------------------------------------------------
> 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]


Reply via email to