March 30, 2005

Happy resource wasters

The day can't go well when it starts with such. That's really sad to see. The guy, who "used exceptions quite extensively to pass messages from the database all the way to the client", tested (no, "tested") cost of throwing exceptions in .NET on his desktop using such "test":

Sub ThrowException()
 Try
 Throw New Exception
 Catch ex As Exception
 Finally
 End Try
End Sub
With Console.WriteLine(Now().ToString("hh:mm:ss.fffffff")) of course :)

And the conclusions are amazing:

1. Modern computers are fast. Really fast. Really, really, really, really, really fast.
3. Throwing one exception won't affect performance.
4. Throwing ten exceptions (nested or otherwise) won't affect performance.
5. Throwing one hundred exceptions (nested or otherwise) probably won't affect performance.
6. Throwing one thousand nested exceptions will most definitely cause your application to perform slowly.
7. The call stack actually supports 1000 levels of recursion
8. Some people don't believe Lessons #1, #3, and #4.
9. An individual's Title does not automatically mean they have any clue what they're talking about.
If some one ever says "because it's faster," think of Lesson #1 and #9 and laugh.
That's what I call a manifest of resource wasters!

March 30, 2005 1:37 PM | #.NET
Comments

"Dont throw Exceptions" is an oversimplified statement. Of course it is perfectly legal to throw exceptions for error handling. That's the purpose of exceptions, and that is why they are called "exceptions" - they should be used exceptionally.

"using exceptions to quite extensively pass messages from the database all the way to the client" seems horribly wrong to me. If you are regularly using this to pass common messages between layers, not just /exceptions/, you are abusing the language design.

This is not about performance or ressource wasting, it is about gross misconception of the language basics.

Posted by: heinzkunz at July 7, 2005 6:13 PM

I've never seen a more true comment!
9. An individual's Title does not automatically mean they have any clue what they're talking about.

I'm going to save this quote if you don't mind. I'll give you credit if I ever send it to anyone.

Posted by: John Workman at March 30, 2005 9:40 PM

Yes, I'm a resource waster and proud of it :-).

Posted by: Alex Papadimoulis at March 30, 2005 9:33 PM
Post a comment




Remember Me?

Trackback Pings

Listed below are links to weblogs that reference this post:

Hi, My Name is Alex, and I am a Resource Waster from Alex Papadimoulis' WebLog
Tracked on March 30, 2005 9:11 PM