usable in any place a human can be used

20100412

saying nothing

[caption id="attachment_838" align="alignright" width="326" caption="Thank you, very helpful"]Dialog saying "Error: An Error has Occurred"[/caption]

As a software developer I have the great joy of making things that piss people off. Nothing makes someone angrier than after an hour of meticulously entering financial data, you hit the submit button and get back the error pictured to the right. In actuality, good software developers go to great pains to make their systems as resilient as possible. A large amount of the code written for any complex piece of software will be dealing with error conditions, recovering from the recoverable, and gracefully reporting fatal errors in a way that indicates exactly what happened and why and what to do about it.


One of the best features an error message can have is Google-ability. If the error has a prominent and distinct feature, then a Google (insert your favorite search engine here) Search will be able to deliver relevant results with a much higher degree of accuracy.


Good Error Message Example:



Error ERS1708A - Invalid Character
The field "Zip Code" should only contain numbers, "47CD101" is invalid.
Examples of valid input: 44130, 90210, 43220


Bad Error Message Example:


Form Invalid!!

The first error might be a little overkill, but the first part meets are Google-ability test. Typing ERS1708A into Google will pull up solutions for this problem. The error goes on to report exactly what went wrong in a user friendly way, it even goes so far as to give some samples of what correct input looks like. The second example gives you a vague idea that something bad has happened, something dealing with a form, and if that form happens to have 100 fields on it, well good luck figuring it out (maybe it's even one of those awesome programs that will clear your entire form on error). The problem is that you are equally likely to get either of these error messages from the same input depending on how much effort the programmer put into error recovery and reporting.


We all know that we should strive to help out the end-user and give them good error messages (even better if we can have robust recovery so we don't have to report errors). The problem is that programmers often have to be toolmakers as well. Sometimes when making a tool for other programmers to use we let our error reporting skills slip, these aren't mouth breathing users, these are 1337h4x0rz and will find your undocumented command line tool completely natural. I ran into this mentality today while troubleshooting a Windows Service installation problem. The Service works great on my development machine, works fine on other peoples laptops, but on the security locked down Mobile Data Terminals that the Service actually has to run on, no dice. The error that was being reported during installation was...


The system cannot execute the specified program

This fails in every way imaginable. Completely un-Google-able, go ahead and try it, you will find everything from people installing things on WinPE, to game development, web controls, Server installation.... a deluge of crap. The error message is amazingly useless, the system can't do something, what can't it do, I don't know, it doesn't even tell me. Can it not execute the install.bat file, maybe the executable called by the install.bat, maybe the executable that executable invokes, who knows?!


Well being a clever programmer and systematic debugger I was able to isolate each piece working towards the fact that what the message actually should have said was, "Although I have all the permissions necessary to access and execute all the programs you want me too, one of the programs requires that the system have the Microsoft Visual C++ 2008 SP1 Redistributable Package (x86) installed on the machine before you try to execute it. If you install that, then I can find the dependencies I'm missing and everything will be cool, kthxbye!"


Error messages are one of the few times that we as programmers get to actually directly communicate to the user. Don't waste this opportunity by effectively saying nothing to the user. The error message is a traumatic thing for most users, happily working along until it pops up, keep it short, sweet, descriptive and helpful.

No comments:

Post a Comment