views:

83

answers:

5

Developer tools and software typically do not provide solution suggestions in error messages. This makes sense for compilers because they are supposed to tell precisely what went wrong.

There are "lint" tools to provide suggestions, but AFAIK, few developers use lint tools regularly or even at all.

There is a large set of developer-oriented software that would do well to have a "suggested solution(s)" part to error messages. This is one of the great features that IDEs like Eclipse have. But software like web application frameworks, standard/popular libraries, etc. do not have this helpful feature.

Is this something that is just lacking in user-friendly design (one can consider this unnecessary, given that Google is so good) or is there a good reason for it? Do any compilers, frameworks, platforms that you use provide error messages with solution suggestions, if none, why not?

+4  A: 

What do you want to see?

Error: Null Pointer Exception (suggested solution: Set the object to something).

I mean, it's not the error writers job to educate you. I prefer simple error messages that point to the exact problem, so I myself can determine just what is causing it this time. For me, this certainly lines in the domain of 3rd party tools; perhaps the compilers could provide extensive context to them, to do their analysis, but it's not something I would really find valuable.

Noon Silk
+1 for "it's not the error writer's job to educate you."
Dan
"I mean, it's not the error writers job to educate you." - agreed! But I'm not talking of compilers at all - if a programmer cannot figure out what to do with a Null Pointer Exception message, he should first learn the language or should not be programming. I'm talking about frameworks, libraries, etc.So I think it essentially comes down to the stack trace, and context-info as you mention, or the user-friendly documentation and quality of training or even popularity (Google search).
namespaceform
As the accepted answer highlights, yes, this is just up to the framework writer. But it's not appropriate for a "stack trace" even; that highlights the call stack. In the exception message maybe, it can point to something, but MS used to do this (I think) and it lead to links that are now dead. Maybe not exactly that, but I have vague memories.
Noon Silk
+1  A: 

The primary thing I want from a compiler or runtime error is context - where did it happen and where was it called from when it failed.

I think most modern compilers and runtimes (Java, Ruby, Go) do a decent job there, with line numbers and stack traces you can find most bugs. Even the Javascript options getting good, it certainly beats the good old "alert()" approach to debugging.

Isn't it fair enough to leave suggested solutions to the IDEs?

But I do agree that I have seen frameworks/libraries that were very sparse with error messages, and "NullPointerException at line 264" deep inside some third-party library where you do not have the source code tells you very close to nothing.

If this is an issue, I think it is primarily restricted to third-party libraries. The "good reason" is presumably that it was developed in a hurry in somebody's spare time, and they did not put meaningful error messages very high on the priority list.

j-g-faustus
+1  A: 

It's hard for the solution to an error being presented. There are so many possibilities and as @silky pointed out, some just cannot be diagnosed.

Warnings are a different beast. In many situations modern compilers use these to say "I think you meant X when you said Y; you might want to check that."

Andrew
A: 

Most IDE's have their own compilers. This allows them to do partial compilation, code refactorings, and many other tricks. I find the error messages and suggestions quite useful. Just because the compiler isn't invoked on the command line, doesn't mean it's not a compiler.

alt text

brianegge
your image giving me, invalid certicated error in my browser opera whenever I surf this page. just FYI, no problem though.
S.Mark
Thanks S. Mark - image fixed.
brianegge
+1  A: 

A programming language has the opportunity to be the ultimate in flexibility in terms of user interface. You can make the computer do anything you want. The flip side of the coin is that if you type so much as one character wrong, it might have no idea along which axis your mistake was made, or where.

Systems with less flexibility offer more opportunities for offering solutions to problems. If you type (a b c) to your Lisp compiler and it doesn't know what a is, it's so close to so many valid lines of code that it can't exactly suggest a single fix. If you misspell "IDENTIFICATION DIVISION" at the start of your COBOL program, it's relatively easy for the compiler to spot the error and help you out. Most other languages lie between these extremes.

Programmers tend to move, over their careers, from less powerful and more structured languages, into more powerful and flexible languages. (At least, that's what I saw happen before Javascript became such a hot newbie language.) This means their discipline improves to the point where they are able to use tools that offer power at the expense of being told what to do. The environments I've used that can tell me what to fix, tend to be those that I dislike using.

It's no different from any other art. Look at musicians or painters or martial artists or actors or writers or chefs or even people learning to speak Spanish: when they're young and inexperienced, they're put in a system where there's a lot of structure, and if they make a mistake somebody can easily correct them. As they become more skilled, they need and want less and less support. When they've become experts themselves, they need no support at all, but the flip side of the coin is that you can't as easily point out what's right or wrong. If your kid colors outside the lines, you can explain the issue, but if Picasso or Pollock makes a bad brushstroke, what would you say? Or if Philip Glass puts a note out of place, or Bruce Lee turns his body too far into a punch? And who would want to work in an art form that's so limited that profane things aren't possible? COBOL compilers still exist if anybody really wants them, but far more people pay money for awful paintings than masterful color-by-number prints.

More directly, there's a site, ErrorHelp (nee bug.gd), that lets you type in an error message and get a result, and it's older than SO but nobody uses it. I've tried. Unless you're in a context where there's only one possible answer, a simple problem-encountered to suggested-solution dictionary does not work, and therefore it's an utter failure in any creative field.

Ken
+1 for the errorhelp.com link. The idea is great indeed. But there's Google !!
namespaceform