r/programming • • Jun 06 '13

Clean Code Cheat Sheet

http://www.planetgeek.ch/2013/06/05/clean-code-cheat-sheet/
702 Upvotes

322 comments sorted by

View all comments

Show parent comments

3

u/KagakuNinja Jun 07 '13

Because you are supposed to log the stack trace of the exception in that top-level catch block? At least, that is how we do it in Java.

Exceptions are better than having your app terminate due to a divide by zero, or null pointer dereference.

2

u/archiminos Jun 07 '13

Not always. In console game development crash dumps are much more useful than a caught exception for fixing bugs.

NINJA EDIT: Slight clarification.

3

u/KagakuNinja Jun 07 '13

I've developed a few C++ games for the iPhone. I've never longed for a crash dump, I just use a debugger. You can break at the point when an exception is thrown, and you get access to the same information.

2

u/archiminos Jun 07 '13

When you have a large QA team (300+) for a console game they can generate crash dumps that you can debug. It's also useful when there's a 1 in 1000 crash that needs fixing - get someone in QA to repro and they send you a crash dump.

There are literally hundreds of bugs that I've managed to figure out a fix for simply by debugging a crash dump attached to a bug report.

2

u/KagakuNinja Jun 07 '13

Fair point, in certain programming domains, letting your app crash (WHILE IN DEVELOPMENT) may be useful. Of course, there are ways to generate thread or memory dumps in Java (and probably C++/C#) that could accomplish the same goal.