Death to isDefined()
Ever come across a couple of lengthy stack traces in your ColdFusion logfile that start with something like "Error in blah - java.net.SocketException: Broken pipe"? Here's what that's about:
While isDefined() may be a convenient way to check the existence of a certain variable, you just should avoid it at all cost and use structKeyExists([SCOPE],"[variableName]") instead.
Not only will structKeyExists() be much faster than isDefined(), as you've told ColdFusion where to look for your variable, so it doesn't have to check through all available scopes. You'll also avoid a lot of useless chatter clogging up your server's log files.
Say you're looking for a variable which at this point is in fact not defined in any of the available scopes and you're using evil isDefined() to do the job. ColdFusion will scan all the available scopes and eventually it would check the CGI-scope, too. And here's our problem: If the original connection from browser to webserver has already been closed in the meantime, which may happen for various reasons, the JRun connector (i.e. the bit that does the communication between webserver and the Coldfusion Application Server) will obviously fail to read the HTTP connection header and tell that tale in the log file in quite excessive detail, full stack trace and everything, although you really couldn't care less about it.
So in essence: Just pretend you never heard of isDefined(). structKeyExists() ist so much nicer and will give you a warm fuzzy feeling all over every time you use it.
