[thelist] Justification for Proper Scoping?

Joshua Olson joshua at alphashop.net
Sun Apr 22 04:28:12 CDT 2001


It's really difficult to pin down why scoping is better than not.  A
seasoned programmer does it because *not* doing it seems to lead to
headaches down the road during debugging.  But, that not being a valid
argument in this case since he apparently is not in that mindset...

"ColdFusion does some inherent mapping of form scoped variables and URL
scope variable to he unscoped variable set.  A potential benefit to
explicitly stating the scope (URL, form, etc) is that you can the easily
presume precedence to the variables as they arrive by simple stating which
you would like to use.  This is nice when a variable drives some important
function, such as being part of a query.  All a person would have to do is
append the variable to the end of the URL and pow, the variable coming off
the form, which holds the correct information, is ignored."

You will have to check for yourself the ColdFusion precedence between the
variable coming off the url and form.  I may have it backwards--though my
point is the same.  You still lose the ability to be dogmatic and
controlling, which is what really brings a smile to most programmers' faces.
j/k

-joshua

> -----Original Message-----
> From: thelist-admin at lists.evolt.org
> Subject: [thelist] Justification for Proper Scoping?
>
>
>
> I've got a situation where one of the people I work with doesn't
> scope his variables. I want to ask him to do so, but other than to
> say "It's good form" or "I prevents errors" i can't offer a valid
> answer. Can someone suggest why variables  should be prefixed with
> URL. Form., etc...?
> --
>
> Frank Marion                      Loofah Communications
> frank at loofahcom.com               http://www.loofahcom.com





More information about the thelist mailing list