Sorry I didn't jump into this thread earlier, but a project I was  
working on kept me away from the lists for most of the day.  In my  
absence, however, it looks like everything that needed to said was said.

In particular, I agree with the posts discussing the value of keeping  
variables private.  Typically there are very few reasons why you would  
want to make a variable public as opposed to creating a public (get)  
method for accessing the variable.  The one exception to this pertains  
to the concept of constants.  A constant is typically a value that you  
want to access quickly and easily from many different places, but only  
store in one place, and that should never change (however if it ever  
were to change, you would be glad you kept it in one place).  Constants  
also let you reference arbitrary or potentially confusing values using  
short and simple names.  The example you often see in programming books  
is "PI".  PI doesn't change, and you certainly don't want to type it  
out every time you need to use it, so it is much easier to type  
"Math.PI".  The problem with using constants in ColdFusion is that  
there is no way to guarantee that other developers won't change their  
values on you.  I have not seen much discussion on the use of constants  
in ColdFusion, but I would be interested in seeing what people have  
come up with.

In short, my general rule is that everything is private unless the  
variable is a constant or is constant-like.

Christian

On Monday, January 6, 2003, at 04:07 PM, Adrocknaphobia Jones wrote:

> Alright,
>
> So Christian says to declare all of your private CFC variables at the
> top of the function like so <cfset var value = 1>.
> Hal Helms recommends using <cfset this.value = 1>. Both obviously work,
> but I'm wondering what the pros and cons are if any.
>
> Off the top of my head, it would seem that 'this' is more functional,  
> as
> it acts like any other scope and can be dumped.
>
> Adam Wayne Lehman
> Web Systems Developer
> Johns Hopkins Bloomberg School of Public Health
> Distance Education Division
>
>
> 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to