[thelist] Friday Freebie

jeff jeff at members.evolt.org
Fri Dec 22 19:09:40 CST 2000


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,

.jeff

name://jeff.howden
game://web.development
http://www.evolt.org/
mailto:jeff at members.evolt.org





More information about the thelist mailing list