It is really nice to get an error like:
File not found: xyz.txt in directory abc
The above is a polite error message and is designed well: it's informative and tells you what's wrong. Is this how freepascal and lazarus programmers often code their programs, or java programmers? Nope.
Often they give you obnoxious errors or exceptions in your end user program like this:
But it is mean and rude and arrogant and horrible (especially for end users) to get an error like:
PROGRAM BLOWN UP AND DANGEROUS ON LINE 421
EXCEPTION KILLED YOUR WIFE TWICE
You have to understand that in this article I'm not attacking or ranting about how exceptions suck and that there are better alternatives. What I'm talking about in this article is "why exceptions could be improved" and about initial impressions and assumptions that people make. For example, your customers or users of the software who may or may not have an idea about what an exception is. As far as they are concerned an exception could be a horrible software death wish for the software or even some person. That's how horrible it is when they see something like above.
Seriously.. exceptions create FEAR and they create RUDE arrogant HORRIBLE experiences when they are 'thrown' at someone so rudely and abruptly. Someone else calls it a digital turd.
The very word 'EXCEPTION' is a dangerous bad negative word.. not something you want your end users to be seeing. End users have no idea what a stack trace is or a funny looking number like $09905442A905 or $%))%)#@##%^.
When end users see this.. they make some initial assumptions and initial impressions about your software.. and what are these?
1. your software is crap
2. the programmers didn't know a thing about programming
3. the software is dangerous
(even though exceptions are supposed to be safer)
4. the software is crap
5. the software is garbage
6. the software is crap
7. the software doesn't work
8. the software is broken
9. the software is RUDE and ARROGANT
10. the programmer didn't care about his customer,
this stupid $0005A66 is shoved in customer's face
The customer doesn't find any of these exception messages polite or courteous, nor does the customer feel he should report the error to you by email since it was so rude. The customer has already decided the heck with this crap I'll take my business elsewhere.
Can exceptions be improved.. or do we ditch exceptions? Of course all we have to do is simply replace the arrogant rude message with a more polite one.. there is no reason to ditch exceptions right away (...there are other reasons to ditch exceptions and invent a better error contract system.. but that is another story and another topic. I am talking about improving exceptions to be better than they currently are by default as shipped with a compiler)
Exceptions as they are today, could be improved.. but everyone seems to prefer rudeness and arrogance... for some unknown reason? Why are the exceptions so rude, ugly, arrogant, and disgusting for the typical computer user? Why haven't programmers who use and invent exceptions gotten a clue?
The rude arrogant messages should at least be nicer messages without swear words like "exception unhandled". Horrible stack trace garbage numbers could also be hidden in a log file for further debugging, as the customer won't have the courtesy to record all of them for you. Basically, polite messages should be sent to the end user instead of rude ones! And once again this isn't necessarily a reason to ditch exceptions.. it's not exceptions alone that are the problem.. it's just the way exceptions currently announce themselves by default.
The impression that people get out of using software or the feeling they get is far more important than you would think.. for example it doesn't matter how important and how essential that $099529593 number and that $001AAA3542 number is to you.. and it doesn't matter if you yourself know what a EBlownUpHere message means... it is the impression and smell that you give off by displaying these to a computer user.. which counts.
I am not advocating unsafe software which corrupts data instead of producing an error. I'm simply demanding that we change the default exception behavior to be more polite. Also of course I am interested in better error contract systems too.. but do not take this as a rant against exceptions.. take it as a "suggestion how to improve exceptions". All that we have to do is think up a more polite way of announcing these messages for the end user. We do not want them to think their wife was killed twice. And that is how they feel when our errors use swear words such as "EXCEPTION" and "UNHANDLED" which is equivalent to shouting "INCOMPETENT PROGRAMMER just BLEW UP your computer".
Suggestion for Modern Pascal: Error Contracts
Joel Spolsky Discusses the problem with exceptions
Verity Stob on Exceptions (digital turds)