[thelist] Friday Freebie

Raymond Camden rcamden at allaire.com
Tue Dec 26 22:26:12 CST 2000


Well, certainly, in cases where you can require input, you should. For
example, custom tags, but there are many example of cases where you can't
always be sure you will have the correct input. The example I used in my
email, a 'details' page, is a perfect example of that. When it comes to
readability, to me, this is much better:

<CFIF NOT IsDefined("URL.ID") OR NOT IsNumeric("URL.ID")>
	<CFLOCATION ...>
</CFIF>

compared to:

<CFTRY>
	<CFPARAM NAME="URL.ID" DEFAULT="0" TYPE="Numeric">
	<CFCATCH TYPE="Any">
		<CFLOCATION ..
	</CFCATCH>
</CFTRY>
<CFIF NOT URL.ID>
	<CFLOCATION ..>
</CFIF>

I guess it comes down to taste. Now, I still take issue with him saying
IsDefined() is not really necessary. You could also say CFLOOP isn't
necessary (just write your code constructs N times :), but you certainly
should use the tools you have at hand.

=======================================================================
Raymond Camden, Principal Spectra Compliance Engineer for Allaire

Email   : jedimaster at allaire.com
ICQ UIN : 3679482

"My ally is the Force, and a powerful ally it is." - Yoda

> -----Original Message-----
> From: thelist-admin at lists.evolt.org
> [mailto:thelist-admin at lists.evolt.org]On Behalf Of chris at fuseware.com
> Sent: Tuesday, December 26, 2000 8:57 PM
> To: thelist at lists.evolt.org
> Subject: RE: [thelist] Friday Freebie
>
>
> I think Jeff's point ( and I agree) is that most typed languages require a
> variable definition. It makes it easier to write modular code if you know
> the inputs and outputs.  Using CFPARAM rather than IsDefined() brings you
> closer to a stronger typed, and more modular language.
>
>
> Chris Evans
> chris at fuseware.com
> http://www.fuseware.com
>
>
>





More information about the thelist mailing list