[thelist] Friday Freebie

Raymond Camden rcamden at allaire.com
Tue Dec 26 20:21:19 CST 2000

Resending my post, because like the other guy, I never saw it get posted...

I understand it may be just a personal feeling, but why do you feel
IsDefined() makes code unreadable? In almost all cases, it's not the
function that makes code unreadable it's the USE of the function, or the
structure of the code. The only exception to this case, imho, is the IIF()
function, which you shouldn't use both for readability issues as well as
speed reasons.

Also, why do you say there is no need for it? How would you get around a
situation like this:

details.cfm expects a URL variable, ID, passed to it. This ID var is used in
a sql statement.

Sure, you can CFPARAM it to some default value, but normally you would
probably rather just send them back to index.cfm or the previous page.

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 jeff
> Sent: Friday, December 22, 2000 6:44 PM
> To: thelist
> Subject: [thelist] Friday Freebie
> here's a friday freebie for those of you who are looking to write the
> tightest cold fusion logic possible.
> <tip type="cold fusion" author=".jeff">
> if you'll recall i take issue with the use of the isdefined() function
> because i feel that it reduces code readability, makes the management and
> use of variables much more difficult, and generally lends to lazy
> programming.  you may also recall that i mentioned that there's only place
> you'll ever actually need to use the isdefined function and that's when
> checking to see if a particular cookie exists before using it.
> i'm happy to report that i was very wrong in that proclamation and that
> indeed there is *never* a time when you have to use the isdefined
> function.
> how do you do this you ask?  it's really very simple, just check to see if
> the cookie you're looking to use is in the list of keys for the cookie
> structure.
> <cfif ListFindNoCase(StructKeyList(cookie), "cookiename")>
>   there's a cookie
> <cfelse>
>   there's no cookie
> </cfif>
> so, no more isdefined() for those of you out there who want to write tight
> code.  those of you who don't?  it'll come back to bite you or the next
> person that has to work on the project one day.  repent now and save
> yourself.
> </tip>
> thanks,

More information about the thelist mailing list