Principle of least astonishment
From Wikipedia, the free encyclopedia
In user interface design, programming language design, and ergonomics, the principle (or rule or law) of least astonishment (or surprise) states that, when two elements of an interface conflict or are ambiguous, the behaviour should be that which will least surprise the human user or programmer at the time the conflict arises, because the least surprising behavior will usually be the correct one.
For example:
- A user interface may have the behaviour that pressing Control-Q causes the program to quit. The same user interface may have a facility for recording macros, a sequence of keystrokes to be played back later, intended to be able to control all aspects of the program. The user may want to record a keystroke sequence that includes Control-Q as part (most likely the last part) of the macro. The principle says that pressing Control-Q while recording a macro should not quit the program (which would surprise the user), but rather should record the keystroke.
Another example (from a real system[citation needed]):
- As per design, a distributed system has a shutdown command that initiates a 2-minute countdown (during which time the user can abort the shutdown) before shutting down the system. Two or more users can order a shutdown at approximately the same time. If one of the users aborts the shutdown, they are informed that shutdown has been terminated. However, because there is still an active shutdown counter running for another user, when that counter reaches zero the system goes ahead and shuts down, astonishing the user who ordered the shutdown aborted.
This practice also involves the application of sensible defaults.
[edit] See also
[edit] External links
- "Applying the Rule of Least Surprise" from The Art of Unix Programming by E.S. Raymond
- Principle of Least Astonishment at Portland Pattern Repository
- Law of Least Astonishment from The Tao of Programming by Geoffrey James