On 2/15/06, Michael Dinowitz <[EMAIL PROTECTED]> wrote:
> But the performance hit only comes when an actual error occurs. When no
> error occurs, the CFTRY/CFCATCH has very little overhead.
> As for the issue of StructKeyExists() over IsDefined(), I've advocated it in
> my presentations for a long time as it is logically more efficient. This may
> be a fallacy, but I believe it to be.
>

Agreed, but, in my humble opinion, a pragmatic programmer correctly
programs for situations that s/he can reasonably predict in advance.
Here's sort of the way I look at it at a broader level:

try/catch should be used around snippets of business logic. Whether it
be a specific algorithm, an external call, or whatever, if you can
reasonably predict that a given section of code can *acceptably* fail,
then you can use cfthrow and catch the exception message. Your code is
so much cleaner than having to write detection logic for error
variables and such. structKeyExists() should be used for the existence
of a specific variable. That's what it's for. That's what the
engineers at Allaire/Macromedia/Adobe had in mind for the function all
along. Let it do what it does best. try/catch around the use of a
variable on the off-chance that it doesn't exist is simply not what it
was designed for, performance aside.

Regards,
Dave.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:232368
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to