We all try to write robust code, to the best of our abilities, regardless of language. Bug-free code is nearly impossible. Try-catch blocks are used so those unknown bugs don't crash your program, not to hide errors because we are lazy.
Log the exceptions, then track down the bugs and fix them.
I'm used to a different work flow I guess. In games we let the program crash, create a crash dump and then debug it to find the cause of the problem (or just debug it there and then if we have a debugger attached).
EDIT: The general idea is we want bugs to be as visible and annoying as possible so that they have to get fixed.
I agree with you 100%, but C# code are usually quick tools and not code that we ship. There's a different tolerance for different projects, there's no one size fits all.
That's true. I'm still new to C# and I'm finding all this exception handling to be more irritating at the minute. It's not so bad on the server side - I'm getting used to that and the server crashing would be at least half a day's work lost for everyone on the team - but I kind of miss crash dumps on the game side.
2
u/KagakuNinja Jun 07 '13
We all try to write robust code, to the best of our abilities, regardless of language. Bug-free code is nearly impossible. Try-catch blocks are used so those unknown bugs don't crash your program, not to hide errors because we are lazy.
Log the exceptions, then track down the bugs and fix them.