I had a recent conversation with an old classmate, and he stated that using assert
s when programming Java is useless because an exception can generate more useful information. Exceptions are only “more useful” if you are a developer or perhaps supporting an application. When a bug report or support case needs to be created, supplying the “raw” errors can be a useful tool in finding a solution.
However, to go back to my friend’s point, he asked how an assert
can “benefit someone that is running the application”. The short version is that NO “error message” that is in the frame for a developer will [likely] benefit the person “running the application”.
David Pogue wrote about this more than a decade ago, but it’s something that still has not taken hold in most applications: the human-friendly error message.
The C Compiler in MPW (a Macintosh programming tool kit) gives you messages like this: “You can’t modify a constant, float upstream, win an argument with the IRS, or satisfy this compiler.” Or this: “Type in (cast) must be scalar; ANSI 3.3.4; page 39, lines 10-11. (I know you don’t care, I’m just trying to annoy you.)” Or how about “This label is the target of a goto from outside of the block containing this label AND this block has an automatic variable with an initializer AND your window wasn’t wide enough to read this whole error message.”
The BeOS‘s native browser, Net+ (pronounced “net positive”), had amusing error messages – in fact, it was those amusing messages that spurred the name of the OSS reimplementation of BeOS, Haiku.
For instance, a user might see the following error message if they try to access a website that is unavailable:
- Cables have been cut
- Southwest of Northeast somewhere
- We are not amused.
If the user tried unsuccessfully to authenticate against a website, they might see:
- Server’s poor response
- Not quick enough for browser.
- Timed out, plum blossom.
One you might see, however, in a product I use frequently:
2011-09-08 19:03:58,590 INFO Thread-12 [org.apache.beehive.netui.util.logging.Logger] [info] Register RequestParameterHandler with
prefix: checkbox_key
handler: org.apache.beehive.netui.tags.html.CheckBox$CheckBoxPrefixHandler
2011-09-08 19:03:58,591 INFO Thread-12 [org.apache.beehive.netui.util.logging.Logger] [info] Register RequestParameterHandler with
prefix: checkbox_group_key
handler: org.apache.beehive.netui.tags.html.CheckBoxGroup$CheckboxGroupPrefixHandler
2011-09-08 19:03:58,592 INFO Thread-12 [org.apache.beehive.netui.util.logging.Logger] [info] Register RequestParameterHandler with
prefix: radio_button_group_key
handler: org.apache.beehive.netui.tags.html.RadioButtonGroup$RadioButtonGroupPrefixHandler
2011-09-08 19:03:58,592 INFO Thread-12 [org.apache.beehive.netui.util.logging.Logger] [info] Register RequestParameterHandler with
prefix: select_key
handler: org.apache.beehive.netui.tags.html.Select$SelectPrefixHandler
Gee, thanks Apache!
Compare that with Google’s Chrome browser that puts a frowny face on a file folder and says “Oh Snap!” when something goes wrong (whether it’s the browser’s ‘fault’ or not).
So why don’t more applications come with “friendly” error messages?
Part of it is because developers too often are concerned with getting something shipped (shipping is a feature, after all), that they don’t stop to consider who is going to actually use the software.
User. The four-letter-word of the development community. Developers all too often (I’m as guilty as anyone on this) of forgetting that what they are writing is for someone else to use. Not for them to work on, debug, develop, extend, and futz with. No, it’s to use.
The average user doesn’t care that some component interacted in a bad way and caused a stack trace… they don’t care that there even are components and stacks to trace!
It takes conscious effort to write message people can care about, or at least understand. And it’s not because the userbase of a given product are dumb: they’re just not developers. Doctors surely are not dumb as a group, but that doesn’t mean they’re qualified to understand a stack trace on the EMR system.
Developers need to take a step back from their work and remember that there are other people in the world beyond just them, and if the more easy and friendly a system is to use and interact with, the more likely people are to want to use it – which might just keep them employed 🙂