Principle of Least Surprise

If you violate the “principle of least surprise” you should be prepared to face the wrath of your users. Here’s today’s example:

The Windows start command does about a million things. One of them is to launch a new process. If you are benchmarking, it can be useful to launch the benchmarked process this way so that you can influence it’s scheduling priority, processor affinity, etc.

The command supports the following two switches, among others:

  • /B – Start application without creating a new window.
  • /WAIT – Start application and wait for it to terminate.

The usage summary includes this output:

START
["title"][/D path][/I][/MIN][/MAX][/SEPARATE|/SHARED]
[/LOW|/NORMAL|/HIGH|/REALTIME|/ABOVENORMAL|/BELOWNORMAL]
[/AFFINITY][/WAIT][/B][command/program]
[parameters]

Notice the order of the /WAIT and /B switches. Guess what? If you issue the switches in this order, the /B switch silently cancels the effect of the /WAIT switch. You need to use the switches in the other order if you want them to work properly. As far as I can tell, these are the only two order-dependent options to start.

Believe it or not, this is the intended and completely undocumented behavior.

Funny, but knowing that this was done on purpose in no way gives me the last hour of my life back.

Advertisements

1 Response to “Principle of Least Surprise”


  1. 1 Chris May 20, 2005 at 7:23 am

    Um, yeah, having options be context sensitive is just wrong, even if it was documented.

    -Chris


Comments are currently closed.




%d bloggers like this: