OdeToCode IC Logo

The Way The Wind Blows

Wednesday, June 27, 2007

You don't need a weatherman to know which way the wind blows – Bob Dylan, Subterranean Homesick Blues.

What direction does the wind blow in your software?

It's easy to feel the direction of the wind when standing outside, but software is subtle. One of the guiding rules in interface design is the Principle of Least Surprise (POLS). This principle states that developers should choose sensible defaults and implement behaviors that don't surprise or astonish users. We can use the rule as a guide when implementing a user interface, or building an API / library / framework.

POLS is more of a policy than a rule, though, because it's impossible to enforce a rule inside the gray zone of how users think. Typically, you have to pick what sort of user your interface targets, and try to give that class of users the least surprising behavior. 

For example, Subversion applied POLS like so:

We should behave as similarly to CVS as possible -- the Principle
Of Least Surprise. This is really important, and was not given
enough attention in the previous discussion imho. There's no
point being gratuitously different if we can be an intuitive
superset instead.

Of course, your approach won't make every user happy. You'll still need to make trade offs. In "10 Things I Hate About Ruby", Elliote Rusty Harold (author of Java I/O) is surprised by some of the conventions in the king of POLS:

Naturally you think the constructor would be defined in a method called new, right? Or just maybe a method called Car like in Java? But no, instead it has to be called initialize like this:

It's impossible to keep every user unsurprised, but it is possible to surprise a large percentage of your users. I tell people all the time that trying to disable the back button in a browser window isn't 100% possible and will astonish the users. Many users like the back button. I like the back button. Still, developers insist on trying to disable the back button. This tells me the software wants me to work under a different set of rules than I expect. When the back button disappears, I know an ill wind is blowing.