I\'ve heard the advice that you should avoid try catch blocks if possible since they\'re expensive.
My question is specifically about the .NET platform: Why are try
Slightly O/T, but...
There is fairly good design concept that says you should never require exception handling. This means simply that you should be able to query any object for any conditions that might throw an exception before that exception would be thrown.
Like being able to say "writable()" before "write()", stuff like that.
It's a decent idea, and if used, it makes checked exceptions in Java look kind stupid--I mean, checking for a condition and right after that, being forced to still write a try/catch for the same condition?
It's a pretty good pattern, but checked exceptions can be enforced by the compiler, these checks can't. Also not all libraries are made using this design pattern--it's just something to keep in mind when you are thinking about exceptions.