[thelist] CF: Error Trapping: Tip & RFC

Joshua OIson joshua at alphashop.net
Wed Jan 10 22:47:28 CST 2001


I think you might've missed my point.  The advise was given in the original
to use cfparam liberally for error avoidance.  My point is, if you are given
the option to use either cfset or cfparam, go for cfset.  You will encounter
times when you *know* that a variable is not set and it needs to be, like in
application.cfm, and times when you don't care what it was before, but need
it to be something in particular right now..  I've seen variable cfparam'd
in there when you know without a doubt that this is the first time a
variable is being used.  So, go for cfset, because it is faster, that's all.
I'm not advocating isDefined, though I disagree with your dogmatic stance on
the issue... but we won't go there.

-joshua


----- Original Message -----
From: "jeff" <jeff at members.evolt.org>
To: <thelist at lists.evolt.org>
Sent: Wednesday, January 10, 2001 8:40 PM
Subject: RE: [thelist] CF: Error Trapping: Tip & RFC


> joshua,
>
> :~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> : From: Joshua OIson
> :
> : In case it hasn't been said before, cfparam is MUCH
> : slower than cfset.
> :
> : Think about what cfparam has to do to 1) parse your
> : string for a variable name, 2) check to see if the
> : variable exists, 3) set it to the value you set.
> :~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> at what expense though?  does the initial overhead of checking to see if a
> variable is defined and then setting it to a value if it isn't worth it
> compared to just using cfparam?  (not to mention how much more work that
is
> and how much more difficult it is to maintain.)  i mean take this example:
>
> <cfif NOT IsDefined("form.checkbox")>
>   <cfset form.checkbox = 0>
> </cfif>
>
> yuck, compared to this:
>
> <cfparam name="form.checkbox" default="0">
>
> especially when you're got a lot of variables and default values to handle
> like this.
>
> :~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> : cfset is much much faster.  Please note, this is just a
> : general aside, and I think your tip was wonderful.
> :~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> and fwiw, if you're setting multiple variables, then it's much faster to
do
> it within a cfscript block.
>
> thanks,
>
> .jeff
>
> name://jeff.howden
> game://web.development
> http://www.evolt.org/
> mailto:jeff at members.evolt.org
>
>
> ---------------------------------------
> For unsubscribe and other options, including
> the Tip Harvester and archive of TheList go to:
> http://lists.evolt.org Workers of the Web, evolt !
>





More information about the thelist mailing list