Exceptions Speak about the Context they are Thrown From

Programmers often make the mistake of assuming that an exception being caught will be an exception that they have seen during testing.  Programmers often underestimate the large variety of exceptions that might occur.  Based on this misunderstanding, programmers will make poor assumptions about what exceptional situation might be occurring, and then jump to an invalid conclusion about the problem the code has encountered, and as a result produce a poor, inaccurate error message. This can easily be avoided if you understand proper usage of exceptions. Continue reading

Advertisement

The Purpose of Error Reporting

Error messages are part of every user experience, but too often these messages are poor, cryptic, and insulting.   Too often programmers do a half-hearted attempt at writing error messages, mostly because they mistakenly assume that users will never see them.  Too often programmers misunderstand the potential that results from writing correct error message.  Error messages can be the key to usability.  Error messages can help train users, and guide administrator.  All you have to do is understand the purpose of error reporting. Continue reading

Don’t Suffer Poor Names

You know the problem: you write a method for one purpose and give it a name.  Later, it become useful for something else, or maybe you change it slightly to accommodate another use, or maybe some names change elsewhere making the current name obsolete.  You have all seen code where someone says that the name “is historical” or traditional.  This post is to say with conviction that that history is NOT interesting, and get rid of it.  Get a good IDE and change those names to be correct. Continue reading