Daily stuff not frequently posted a software developer finds out or rants about.

Saturday, September 09, 2006

Error messages

Even though the following topics about error messages are quite logical, they're something very often neglected by developers, so I decided to let some steam of here. The difficulty with good error messages is that they need to contain three things:
  1. Information telling the user what went wrong.
  2. Information telling the user how he could prevent this problem.
  3. Information helpful to the developer for debugging.
Developers very often think only about the topic #3, hoping this will help them to fix the problem. But there is no application that is completely without errors at all, so it is very important to give a good description of what went wrong (#1). And to help the user continue to work after the error, it might be helpful to give him a hint on how to procede.
Examples of bad error messages:
  • Error 123: FILE_NOT_FOUND
    Speak English (or whatever language your application comes in) and in full sentences instead!
  • File not found!
    Let the user know which file exactly was not found, and what he could try if he really thinks the file would be there, e.g. mapping a networking drive instead of using a UNC path.
  • Could not open file!
    So what? Think about the one or two major reasons for this, and tell the user what he can try to avoid this error, e.g. closing the file in other applications, restart your application, etc.
Examples of proper error messages:
  • Could not open file "x:\something.txt" (error 0815). Please make sure that the file and it's drive are available, and that the file is not opened in any other application currently.
I could go on for a while, but won't, since it's easy once one get used to not just use WriteLn('Error 123'); for debug purposes. For those, write your stuff to a debug pipe instead, where you probably can leave them in you really want to, since they'll show only when using proper debugging tools.

Thursday, September 07, 2006

Windows Vista RC 1

I haven't really added a lot of stuff here, since I'm currently undecided whether my current project will continue on Delphi (or maybe Turbo?) or Lazarus. Meanwhile, I've been trying to install Vista RC 1 in a VMWare virtual machine, and since this caused a lot of problems, and there are so many maybe-solutions out there, I wanted to post the one I found that is really working. Just edit the .vmx file of the virtual machine, and add the following to it:

disable_acceleration = "FALSE"
xinfo.noDGA = "TRUE"
svga.maxWidth = "640"
svga.maxHeight = "480"


After the installation has finished (and important, after you've installed the VMWare Tools!), you should remove those lines.

Other solutions I read about, but didn't work or where too error-prone for me would be:
  • Pre-allocate space for the hard disk (didn't work).
  • Format the hard disk with NTFS through XP installation CD (didn't work with that, nor Ubuntu partition manager and formatting).
  • A lengthy list of keys to press (would manage the invisible interface, but I didn't want to make typos). This is probably what is called The Stevie Wonder Solution on the VMWare forums.
  • Upgrading Beta 2 should work, but my Beta 2 partition was too small for the upgrade, so better allocate a few GBs more now.