Jump to content

Principle of least astonishment

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by Asalewski (talk | contribs) at 18:25, 9 April 2020 (Change url in citation for esr's book "The Art of Unix Programming" from faqs.org (which gives an HTTP 500 error) to the same content at esr's site, catb.org, which works. Also update the 'accessdate' property to reflect today's date.). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

The principle of least astonishment (POLA), also called the principle of least surprise (alternatively a "law" or "rule")[1][2] applies to user interface and software design.[3] A typical formulation of the principle, from 1984, is: "If a necessary feature has a high astonishment factor, it may be necessary to redesign the feature."[4]

More generally, the principle means that a component of a system should behave in a way that most users will expect it to behave; the behavior should not astonish or surprise users.

Formulation

A textbook formulation is: "People are part of the system. The design should match the user's experience, expectations, and mental models."[5]

The principle aims to leverage the pre-existing knowledge of users to minimize the learning curve, for instance by designing interfaces that borrow heavily from "functionally similar or analogous programs with which your users are likely to be familiar".[1] User expectations in this respect may be closely related to a particular computing platform or tradition. For example, Unix command line programs are expected to follow certain conventions with respect to switches,[1] and widgets of Microsoft Windows programs are expected to follow certain conventions with respect to keyboard shortcuts.[6] In more abstract settings like an API, the expectation that function or method names intuitively match their behavior is another example.[7] This practice also involves the application of sensible defaults.[4]

When two elements of an interface conflict, or are ambiguous, the behavior should be that which will least surprise the user; in particular a programmer should try to think of the behavior that will least surprise someone who uses the program, rather than that behavior that is natural from knowing the inner workings of the program.[4]

The choice of "least surprising" behavior can depend on the expected audience (for example, end users, programmers, or system administrators).[1]

Examples

A website could have an input field that focuses automatically after the page loads,[8] such as a search field (e.g. Google Custom Search), or the username field of a login form.

Sites offering keyboard shortcuts often allow pressing ? to see the available shortcuts. Examples include Gmail[9] and Jira.[10]

In Windows operating systems and some desktop environments for Linux, the F1 function key typically opens the help program for an application. A similar keyboard shortcut in macOS is Command+⇧ Shift+/. Users expect a help window or context menu when they press the usual help shortcut key(s). Software that instead uses this shortcut for another feature is likely to cause astonishment if no help appears. Malware may exploit user familiarity with regular shortcuts.[11]

A programming language's standard library usually provides a function similar to the pseudocode ParseInteger(string, radix), which creates a machine-readable integer from a string of human-readable digits. The radix conventionally defaults to 10, meaning the string is interpreted as decimal (base 10). This function usually supports other bases, like binary (base 2) and octal (base 8), but only when they are specified explicitly. In a departure from this convention, JavaScript originally defaulted to base 8 for strings beginning with "0", causing developer confusion and software bugs.[12] This was discouraged in ECMAScript 3 and dropped in ECMAScript 5[13]

See also

References

  1. ^ a b c d Raymond, Eric Steven (2003). Applying the Rule of Least Surprise. faqs.org. p. 20. ISBN 978-0-13-142901-7. Retrieved 2020-04-09. {{cite book}}: |work= ignored (help)
  2. ^ James, Geoffrey (1987). Law of Least Astonishment. 4.1. ISBN 0-931137-07-1. Retrieved 2014-02-05. {{cite book}}: |work= ignored (help)
  3. ^ Seebach, Peter (2001-08-01). "The Principle of Least Astonishment". The cranky user. IBM DeveloperWorks. Retrieved 2014-01-23.
  4. ^ a b c Cowlishaw, M. F. (1984). "The design of the REXX language" (PDF). IBM Systems Journal. 23 (4): 333. doi:10.1147/sj.234.0326. Retrieved 2014-01-23. Could there be a high astonishment factor associated with the new feature? If a feature is accidentally misapplied by the user and causes what appears to him to be an unpredictable result, that feature has a high astonishment factor and is therefore undesirable. If a necessary feature has a high astonishment factor, it may be necessary to redesign the feature.
  5. ^ Saltzer, J. H.; Kaashoek, Frans (2009). Principles of computer system design: an introduction. Morgan Kaufmann. p. 85. ISBN 978-0-12-374957-4.
  6. ^ Petroutsos, Evangelos (2010). Mastering Microsoft Visual Basic 2010. Wiley. p. 133. ISBN 978-0-470-53287-4.
  7. ^ Bloch, Joshua (2006). "How to design a good API and why it matters". Proceeding OOPSLA '06 Companion to the 21st ACM SIGPLAN symposium on Object-oriented programming systems, languages, and applications. Association for Computing Machinery. pp. 506–7. doi:10.1145/1176617.1176622. ISBN 1-59593-491-X. {{cite book}}: External link in |chapterurl= (help); Unknown parameter |chapterurl= ignored (|chapter-url= suggested) (help)
  8. ^ "Forms in HTML". Mozilla Developers Network. Mozilla. Retrieved 2013-07-27.
  9. ^ Vivian (2013-06-21). "Keyboard shortcuts for Gmail". Google Inc. Retrieved 2013-07-27.
  10. ^ "Using Keyboard Shortcuts". Atlassian. Retrieved 2013-07-27.
  11. ^ Keizer, G. (1 March 2010). "Microsoft: Don't press F1 key in Windows XP". Computerworld. Retrieved 10 Nov 2019.
  12. ^ "Why does the radix for JavaScript's parseInt default to 8?". Stack Overflow. 8 April 2011.
  13. ^ "parseInt()", Mozilla Developer Network (MDN), If the input string begins with "0" (a zero), radix is assumed to be 8 (octal) or 10 (decimal). Exactly which radix is chosen is implementation-dependent. ECMAScript 5 clarifies that 10 (decimal) should be used, but not all browsers support this yet.