[thelist] Friday Freebie

chris at fuseware.com chris at fuseware.com
Tue Dec 26 21:19:27 CST 2000


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



-----Original Message-----
From: thelist-admin at lists.evolt.org
[mailto:thelist-admin at lists.evolt.org]On Behalf Of Raymond Camden
Sent: Tuesday, December 26, 2000 7:56 PM
To: thelist at lists.evolt.org
Subject: RE: [thelist] Friday Freebie


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,
>


---------------------------------------
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