Wednesday, December 26, 2007

Watch Your Spacing

Remember with some systems, spacing counts.

foo (bar)

is not the same as

foo(bar).


This is fine in some circumstances, and can be useful when you're using space-delimited options (say, in a command line interface). However, be aware that at some point your users will get this wrong. So if you're going to be picky, you need to provide feedback to users right where they're entering the option.

If it's in a config file, throw an error message when the config is read. If it's on a command line, throw an invalid argument error. If it's in a GUI, put up a nice error message next to the field that is affected.

True example:
Today I created an NFS share and put in an access control list with an option. It looked like this:

Access: 10.0.0.20 (my_option)

There was a space in it.

The end result is that the share wouldn't export. It took us 45 minutes to track it down to that space.

So do your users an error and throw a nice error when the syntax is that picky. Spaces are both picky and hard to see from documentation.

No comments:

Post a Comment