blob: 4011cf57fa371ca6a0b0ccebdd5eefd788c2cae3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
#+TITLE: Default the most-common choice, friction proportional to consequence
#+SLUG: default-most-common-friction-proportional
#+PRINCIPLE: Default the choice the user most often wants, and size the friction to the cost of being wrong.
#+PROBLEM: "Always default to yes" optimizes the wrong thing; the right default is the most-common choice, and destructive choices should keep their friction.
#+TAGS: prompts defaults yes-no confirmation safety
#+SOURCE: pearl commit 505e707 (read-yes-no helper), handoff note 2026-05-28
#+EXAMPLES: pearl read-yes-no helper; destructive prompts stay yes-or-no-p
* Problem
A first cut at yes/no prompts is "default to yes so RET takes it." That defaults to a fixed answer rather than the right one. What the user actually wants is the most-common or preferred option on top, and sometimes that's "no." A blanket default-and-go is also wrong for destructive choices, where typing the answer is a safety feature, not friction to remove.
* Do
Take the default as a parameter and order the candidate list with it first, so the framework highlights it and RET takes it without typing:
#+begin_example
read-yes-no PROMPT &optional DEFAULT ; default-first ordering
#+end_example
Size the friction to the consequence. Non-destructive confirmations get the default-on-top, one-keystroke treatment. Destructive ones (delete issue, delete saved query) deliberately stay full =yes-or-no-p=. The user types "yes" on purpose. Naming this companion rule keeps the principle from collapsing into "always default-yes."
* Anti-pattern
Two failure modes. Hardcoding "yes" as the default regardless of which answer is actually most common. And stripping friction uniformly, so a destructive action is one accidental RET away.
* Applicability
Every confirmation or small multiple-choice prompt. The default-first helper makes the next prompt where "no" is more common a one-argument change rather than a special case. The friction rule applies wherever an action is hard to undo.
* Related
The ordering and friction halves of the root principle. Composes with [[file:no-empty-input-as-meaningful.org][no-empty-input-as-meaningful]] and [[file:label-matches-behavior.org][label-matches-behavior]].
|