May 15, 2024

The Law of Demeter and the right to bear arms

This essay was originally posted on 2016-01-12.

Contents

I.

Patterns crystallize in strange ways.

Have you ever had a conversation like this?

Person A is leaving the house; person B notices.
B: Hey, where are you going?
A: Hm? Why?
B: What, you can’t tell me?
A: Why do you ask, though?
B: Oh, well, if you were going to <place>, I was going to ask you to do something on the way, but if you’re not going there then never mind…

(Variants include “what are you doing tomorrow” / “oh in that case you’ll have time to do something for me”, “what are your plans this Saturday” / “oh well if you’re free then you can come help me with something”, “are you planning to do <thing X>” / “oh in that case you can do something for me while you’re at it”, etc.)

As person A in this conversation, you might be tempted to reply (as I often am) along these lines:

“Look, if you want me to do something for for you, just ask me to do that thing. I’ll decide whether it’s on the way, whether it’s convenient, whether it’ll be ‘no bother’, and so forth. If it’s not, I’ll tell you; I’m an adult, I’m capable of saying ‘no’. Or maybe it’s not on the way, but I’ll decide to do it anyway. In any case, it’s my decision; don’t try to make it for me! Don’t interrogate me about my plans; they’re none of your business. Tell me what it is you want, and I’ll decide what I’ll do about it.”

But maybe I’m just a curmudgeon.

II.

The Law of Demeter (a.k.a. the principle of least knowledge) is a concept in object-oriented software design. It says that an object should have limited knowledge about other objects, and shouldn’t know anything about the inner workings of other objects (as opposed to their behavior). The Law of Demeter is closely related to the “tell, don’t ask” principle—the idea that an object in a program should tell another object what to do, rather than requesting some component of the second object’s implementation or internal state, then doing something directly using that “borrowed” component. (If one object provides another object with access to its inner workings, who knows what the other object might do with that access?)

The Law has been stated and explained in many ways. One oft-encountered analogy involves a paperboy who wants to get paid for delivering the newspaper. Should the paperboy reach into the customer’s pocket, pull out the wallet contained therein, and take some cash right out of said wallet?

Of course not. The paperboy tells the customer to pay him, and the customer pulls out his own wallet, takes out some cash, and hands it to the paperboy. Or maybe he goes and gets some cash from under his mattress instead. Or maybe he asks his wife for cash, because she handles the finances in the family. None of this is the paperboy’s business; he simply does not need to know anything beyond the fact that he asks for payment, and he gets paid. (After all, if the customer just hands the wallet over to the paperboy, who knows what the paperboy might do with it? Take out more money than he ought to get, maybe! We just don’t know; and trusting the matter to the paperboy’s honesty and judgment is foolish in the extreme.)

What implications the Law of Demeter has in actual software engineering practice is a matter of much discussion. But reading some of that discussion reminded me of that conversation from part I. And then… well, everyone knows that generalizing from one example is bad; but once you’ve got two examples, you’ve got a hammer pattern.

III.

In the comments section of Scott Alexander’s recent post on gun control, commenter onyomi talks about pro-gun-control arguments of the form “do you really need <insert some form of rifle or other “powerful” firearm>?”:

See, I just hate seeing a policy debate framed in terms of what the citizen “needs.” The question should be, “is there a really good reason to restrict a citizen’s presumptive right to buy whatever he wants in this particular case?” rather than “do you need this?” If you want it, are willing to pay for it, and there’s no very pressing reason why you shouldn’t be allowed to have it, then you should be allowed to have it. The question of “need” shouldn’t even arise.

I sympathize with this view. If I encountered an argument like that—“do you really need …?”—I might be tempted to reply along these lines:

“It’s none of your damn business what I do or don’t ‘need’. If you want to ban me from owning something, or doing something, well—make a positive claim that I shouldn’t be allowed to have or do that thing, make a case in support of that claim, and we’ll go from there. But I am certainly not obligated to stand for an interrogation about what I ‘need’. In any free society, and certainly in the United States, the default is that I have a right to do and to own whatever I damn well please, without having to explain or justify myself to anyone. If you want to curtail that right somehow, the responsibility is on you, the advocate for state intervention, to demonstrate to my satisfaction (or, to put it another way, to the public’s satisfaction) that this curtailment is necessary or desirable—not on me, the citizen, to prove to you that it’s not. Make your case, and I might even agree with you! Certainly I don’t think that people should be allowed to do just anything; I’m not an anarchist. But you don’t get to start the conversation by demanding an account of what I ‘need’.”

This isn’t an argument against gun control. Even if you agree with every letter of my hypothetical reply, the question of gun rights is not settled thereby. This is a response to one class of argument: the sort that demands access to my internal state, and then bases further arguments on the basis of that revealed internal state. My view is that once I’ve agreed to discuss with you the question of what decisions or conclusions should follow from this or that aspect of my internal state, I’ve lost—regardless of what side of the debate I’m on. Instead, I reject the presumption that my internal state is any of your business.

IV.

Tabletop role-playing games are notoriously rife with quasi-religious debates about the Right Way To Play. One such dispute concerns the concept of the so-called “mother, may I” style of play. The question at issue is, what determines what your character can do? Different games, different game-masters (GMs), and different gaming groups or communities have answered this question in various ways. (Often, different aspects of the same game system answer this question in ways that fall on different places along the spectrum of possible answers.) But roughly speaking, any answer to this question falls into one of two categories.

In one camp are the people who say: here are the rules. These rules fully describe what options are available to your character—what actions you can take, how your character can develop, what exists in the game world, exactly what happens when your character takes this or that action, and so forth. If you want to do something that isn’t covered by the rules—too bad; you can’t. No pleading or argument will let you step outside what the rules allow. But within the rules, you’re free to do as you like; no further restrictions are placed upon you. Even if the GM doesn’t like it, “the rules is the rules”—no special treatment for anyone.

The people in the other camp think that “the rules is the rules” is fundamentally too restrictive; it stifles players’ creativity, and places artificial limitations on characters’ actions that may make no sense within the logic of the game world. Also in this camp are GMs who don’t like being rigid and inflexible, or who pride themselves on being able to improvise and invent ways to handle anything their players can dream up, as well as those GMs who feel that their role is to make the players’ desires and intentions happen, rather than to be computers who faithfully implement the rules as written. Players who don’t like being told that their character can’t do something that they think they should be able to, and those who enjoy coming up with unusual, bizarre, or creative plans and solutions, according to their own model of the game world and the situations in it (even when that model contradicts the game rules), are in this camp as well.

The answer to the “what can a character do” question that’s espoused by those in the latter camp is: describe to the GM what you want your character to accomplish. He’ll tell you if it’s possible or not, and he’ll decide what happens if your character tries to do that thing. The GM decides how the game world reacts to your character’s actions, the details of how your abilities work, and so forth. The rules, whatever they may say, are not a straitjacket; they’re guidelines, perhaps, or suggestions—and you’re not limited by them. Your character can, at least in principle, do whatever you can think of; tell the GM what you want to accomplish or what sort of action you want to take, and if it’s something that makes sense, or if the GM agrees that your character should be able to do that thing, then you can do it. Likewise, the GM will determine, and tell you, how your character can accomplish what you’re trying to do, and what the results will be, and so forth.

The term “mother, may I?” is a derogatory description of the latter approach, encapsulating a criticism of that approach that’s often made by those in the former camp. The criticism is this: yes, the rules no longer limit you. But neither do they shield, empower, or inform you. Now, you’re at the mercy of the GM’s whim. Before, the challenge was: can you figure out how to accomplish what you want to do, with these known rules, which are laid out before you and will not be altered? Now, the challenge is otherwise: can you persuade the GM—no computer he, but a fickle human, whose mind is full of biases, strange notions, and moods which the winds of chance, or last night’s ill-digested pizza, might sway this way or that—of your plan’s reasonableness? Before, you could confidently say: “My character does this-and-such, as the rules clearly say that he can”. Now, you’re the child who beseeches the GM to permit your actions: “Mother, may I…?”

“Hmm, and what is it you’re trying to accomplish? What’s your goal?” asks the GM. You must explain, as the GM listens and nods, and judges whether he wants your plan to succeed or fail, whether your goals shall be accomplished or whether your designs shall be frustrated, according to his own inscrutable design; and on that basis, he decides what options for action he will permit your character to have. Even if he does allow your character to do what you ask him to permit, the consequences of that action are decided not by any mechanism which you may inspect, and whose workings you can master, but by the GM—by the unpredictable goings-on inside his mind, which determine whether your plan “makes sense” to him—a determination which is quite beyond your control. You can attempt to convince him, of course. You can plead your case—not by mere reference to the rules, no! they’re only suggestions now, after all, and may be overruled as the GM pleases—but by vague and dubious appeals to “common sense”, ill-defined principles of dubious applicability (from game design, physics, personal experience, or just about any other source you can pull in), tangentially related “facts” of questionable accuracy, emotional arguments about what you want and what’s “important to the character concept”, and anything else you can think of. If it works—if it gets the GM to adopt your view—it’s fair game.

When “mother, may I?” reigns, you don’t know what your options really are. Those options might change from day to day. You don’t know how the game world really works (because it works in whatever way “makes sense” to the GM, who is no longer bound by those same rigid rules which you discarded in your pursuit of greater freedom). And the game is no longer a cognitive challenge, an exercise in creativity, strategic thinking, understanding and mastery of complex systems, and all the other sorts of challenges that TTRPGs excel at providing. Now, it’s a game of persuasion, of manipulation, of phrasing your pleas in the right way (or just being louder and more insistent). How droll.

That’s the argument, anyway. Of course, in practice, no sensible gamer takes either view to its extreme, nor takes the same position on the spectrum in every single situation. But at the heart of this conflict of two philosophies of game design is the same sort of thing as in the examples given in the previous parts. Instead of simply being told—what someone wants from you, what you must do, what is legal, what is allowed—you’re asked to open up your internal state for inspection and judgment. Your interlocutor refuses to provide well-defined rules, binding upon you and him both. Instead, he demands that you tell him all about your plans, your needs, your intentions, your inner workings; then, he says, he’ll make his decision—on the basis of a decision procedure that he, and not you, will carry out.

In the RPG case, gamers with views closer to the “rules is the rules” end of the spectrum may respond to such demands along these lines: “Look, it’s none of your business what my intentions are, or what I’m trying to accomplish. My plans are my own; my internal state is not available for your viewing. I have no interest in attempting to convince you that you should permit me to do what I want to do; don’t ask me to justify why you should allow me to take this or that action. Describe the world; tell me what the rules are; and I’ll decide on a course of action.”

V.

Of course, devotees of role-playing games aren’t the only people to prefer rigid, known-in-advance rules over the chance to secure an ideal outcome by persuading a human decision-maker that they deserve it. Legal scholars and rationalists alike have recognized the value of stare decisis, or the notion of precedent—that the courts should not (at least, barring extraordinary circumstances) make decisions that contradict previous decisions made by other courts in similar cases.1 Why have such a principle? Surely a more context-sensitive approach would be better? Even “similar” cases differ in details, after all, and may involve different people, who come from different backgrounds, etc.; shouldn’t judges evaluate each case in isolation, and make whatever decision seems most appropriate to the circumstance?

A similar question may be asked about the concept of equality before the law. Why should people be equal before the law? Aren’t different people… different? Shouldn’t a judge treat every person who appears before them as distinct individuals, rendering whatever decisions seem most appropriate to the circumstances—regardless of how other courts (or even the same court) may have treated other people in “similar” cases?

I leave it to others to explain the value of the law’s predictability, and its effect on freedom of self-determination. Links between stare decisis and the psychology of motivation, too, would make fertile ground for blog posts, and the essay on the implications of both said topics for the design of user interfaces is practically written in my head already—but that is a matter for another day. Right now, I’ll just say that contextualism—the view, described above, that says we should judge legal cases on an individual basis, and that opposes the principles of both precedent and legal equality—inevitably requires exposure of the petitioner’s internal state. For one thing, it’s simply a competitive advantage: someone who bares their heart to the (precedent-rejecting, context-embracing) arbiter of their fate will often have a better shot at a favorable outcome than someone who won’t—we humans are suckers for a sob story, we sympathize more when we relate better, we relate better when we feel that we know someone better, and so on… But even more: the arbiter will demand it, will demand explanations, justification, an account of intent, belief, and mental state, a claim of needs and a convincing case for them… because how else can you fully grasp the context of a matter? In short, if we commit to judging every case on its own merits, and taking full view of the unique, individual situation that surrounds it, then we will find ourselves saying: you who stand before us—give us full access to your internal state, that we may inspect and judge it.

VI.

One may wonder what comes of having such a system. Maybe it’s nothing bad? Isn’t being open a good thing, in general? Open source, open borders, open bars… seems legit. Why not throw open the shutters of our hearts? Why shouldn’t other people have access to our internal state? Ok, if not literally everyone, then at least people who have power over us, who make decisions that affect us—shouldn’t they have all the information?

“Those people might be bad people! They might maliciously use this privileged access for bad purposes!” Yeah, that’s true. But let’s not stop at the easy answer. Let’s say we trust that those who stand in judgment over us are good people, who have the best intentions. Perhaps we should tell them everything about ourselves—present an account of our needs, say—and let them decide what we should get, and what we should do. What comes of this?

“Well, there was something that happened at that plant where I worked for twenty years. It was when the old man died and his heirs took over. There were three of them, two sons and a daughter, and they brought a new plan to run the factory. … The plan was that everybody in the factory would work according to his ability, but would be paid according to his need. …

“It took us just one meeting to discover that we had become beggars—rotten, whining, sniveling beggars, all of us, because no man could claim his pay as his rightful earning, he had no rights and no earnings, his work didn’t belong to him, it belonged to ‘the family’, and they owed him nothing in return, and the only claim he had on them was his ‘need’—so he had to beg in public for relief from his needs, like any lousy moocher, listing all his troubles and miseries, down to his patched drawers and his wife’s head colds, hoping that ‘the family’ would throw him the alms. He had to claim miseries, because it’s miseries, not work, that had become the coin of the realm—so it turned into a contest between six thousand panhandlers, each claiming that his need was worse than his brother’s. How else could it be done? Do you care to guess what happened, what sort of men kept quiet, feeling shame, and what sort got away with the jackpot?” …

“Any man who tried to play straight, had to refuse himself everything. He lost his taste for any pleasure, he hated to smoke a nickel’s worth of tobacco or chew a stick of gum, worrying whether somebody had more need for that nickel. He felt ashamed of every mouthful of food he swallowed, wondering whose weary nights of overtime had paid for it, knowing that his food was not his by right, miserably wishing to be cheated rather than to cheat, to be a sucker, but not a blood-sucker. He wouldn’t marry, he wouldn’t help his folks back home, he wouldn’t put an extra burden on ‘the family.’ Besides, if he still had some sort of sense of responsibility, he couldn’t marry or bring children into the world, when he could plan nothing, promise nothing, count on nothing. But the shiftless and irresponsible had a field day of it. They bred babies, they got girls into trouble, they dragged in every worthless relative they had from all over the country, every unmarried pregnant sister, for an extra ‘disability allowance,’ they got more sicknesses than any doctor could disprove, they ruined their clothing, their furniture, their homes—what the hell, ‘the family’ was paying for it! They found more ways of getting in ‘need’ than the rest of us could ever imagine—they developed a special skill for it, which was the only ability they showed. …

“We were a pretty decent bunch of fellows when we started. There weren’t many chiselers among us. We knew our jobs and we were proud of it and we worked for the best factory in the country, where old man Starnes hired nothing but the pick of the country’s labor. Within one year under the new plan, there wasn’t an honest man left among us. That was the evil, the sort of hell-horror evil that preachers used to scare you with, but you never thought to see alive. Not that the plan encouraged a few bastards, but that it turned decent people into bastards, and there was nothing else that it could do—and it was called a moral ideal!”2

(Don’t let the talk about the “shiftless and irresponsible” distract you. Change happens at the margins; you get what you incentivize. And as usual, the greatest enemy is not around us, but within us.)

VII.

So maybe it takes a contrarian and malcontent like me to see this pattern in the sort of conversation described in Part I (a fairly innocent exchange, all things considered), but clearly, many people have noticed it in lots of other places, and they seem to take a rather dim view of it. The interesting question is, why does anyone not object to this sort of thing? Why does “I demand to know all about your internal state” ever work?

Our as-yet-unnamed pattern is a certain sort of illusion—a thing that masquerades as its opposite. The one offers you a bargain: “Open yourself up to me—give me information about yourself, allow me access to your inner workings, your internal state—and I will control you less.” Less? “Sure—if I know more about you, I can make less onerous demands; I can ask for only what you’re able to give; I can restrict you less, changing the rules so that they don’t prevent you from doing what you want to do; I can make sure your needs are met, as much as possible. In doing these things, I’ll be relieving your hardships, easing your burdens.”

In short, you’re offered greater freedom. But in every case, it’s an illusion. By surrendering the secrecy of your internal state, you make yourself less free, not more; though it may not always be obvious how.

What motivates the conversation described in Part I? Person B wishes to promote illusion that their request isn’t really an imposition at all, that person A is doing them a very minor favor, at best. After all, if you’ve revealed your internal state to me, I can now judge for myself what is or isn’t an imposition for you, and what costs you bear for doing what I want you to do, and whether those costs are reasonable. You can argue with me, dispute my judgments; but by doing so, you tacitly admit that this is now a matter that we have to settle by debate. You’re no longer sole authority on what you may reasonably be asked to do, and what you ask in return; now I may weigh in also.

In the RPG case, the game-master who says “Tell me what you want to accomplish, what your intentions and goals are, and I’ll decide whether that’s possible and allowed, and how you can do it”—is he giving his players more freedom, as he might claim? With the flexible “cooperation” of the GM replacing the cold and rigid rules, the players are much less limited! No; rather, the GM gives himself more power—the power to shape the game world according to whim, the power to decide at each step and level whether the players’ plans succeed or fail, where otherwise they might fairly win, surprising him with their cleverness and cunning, their success assured by the rules.

And in our other examples, you might gain the chance to secure a better outcome (if your powers of persuasion are good enough) than you would if the arbiter were systematic and impartial—but now your obligation to make your internal state available for judgment binds you like a set of chains. And what have you really gained? Today the outcome might be favorable, but tomorrow I might alter my accounting of what conclusions or decisions follow from what you’ve revealed, and your fate reverses. Or, with your inner workings laid bare for my inspection, perhaps I might decide that those inner workings are objectionable somehow. Tell me what your needs are, and perhaps I’ll judge that you shouldn’t have such needs—no one ought to have such needs. You’re not even back at square one, then; it’s much worse than that. Rather than chafing under rules that tell you what to do, you’re now given rules about whom to be.3

VIII.

But there’s another sort of cost to abandoning encapsulation.

Once I reveal my internal state you—once I report my plans and intentions to you, once I present an account of my needs, once I submit the details of my life for your inspection—I lock myself down, on all of the things I’ve revealed. The fact that you are basing decisions—ones that affect my life, and perhaps the lives of others—on what I’ve revealed to you, exerts pressure on me, to be exactly that way, to conform to what I’ve revealed, not to deviate, not to change. If you’ve only based your weekend plans on what I’ve let you see, the pressure comes from the threat of mild social disapproval, and I am constrained only in a minor way—but constrained nonetheless. If my internal state forms the basis for decisions about legal cases, or the distribution of resources, or national policy—then I am hard pressed indeed, and loss of freedom I suffer thereby is great, much greater than the imposition from all but the most draconian of laws. There are few freedoms as vital as the freedom to change one’s mind.

Of course, programmers have known about this for some time. Thus the Law of Demeter—because my internal state is none of your business.

1 And I am not even the first to notice the parallel with RPGs.

2 Atlas Shrugged, of course. The entire speech makes for riveting reading, despite Ayn Rand’s lack of talent for brevity.

3 An interesting parallel is the point that Slavoj Žižek makes in this video.

November 14, 2021

Different views on the same data

The idea of “different views on the same data” is crucial. It’s ubiquitous in desktop applications—so much so that we forget about it—the proverbial water to the proverbial fish. It’s not nearly as common in modern web apps as it should be. Here are some examples, that we may better grasp just how basic and fundamental this concept is.

Contents

Example one: Finder windows

Note for non-Mac-users: the Finder is the graphical file manager on the Mac OS. (It also does other things, but that's the part of its role that we're concerned with here.)

In all of the examples in this section, the data is the same: “what files are in this folder?” Let’s look at some of the possible views onto this kind of data.

Figures 1–4 show the same folder in each of the four different available view modes: list, icon, column, and cover flow.


Figure 1. Finder window in list view. Miscellaneous files.

Figure 2. Finder window in icon view. Miscellaneous files.

Let's play a game of “spot the difference” between Fig. 1 (list view) and Fig. 2 (icon view). Here we're not concerned with visual differences, but with UX differences. Here's a partial list:

(1) List view shows more metadata. (Here we see modification date, size, type; view options allow us to show more/other columns, like date added, version, tags, etc.)

Does the icon view show no metadata at all? Nope, it shows at least one piece of metadata: the file type—via the file icon. (This is an example of multiplexing; the icon has to be something—to provide a visual representation of a file, and to provide a click target—so why not multiplex file-type data into it?)

Of course, the icon is also visible in list view (but smaller); this means that in list view, file type is conveyed twice (if the “Kind” column is enabled). This is an example of redundancy in UI design, and of good use of sensory (in this case, visual) bandwidth (of which there is quite a lot!). Notice that this redundancy affords the UI a degree of freedom it would not otherwise have: the “Kind” column can be turned off (making room for other data columns, or allowing the window to be made smaller, to make room for other stuff on the screen) with minimal loss of information throughput for the UI.

But wait! What about the file name? There's metadata lurking there, too—the file type again, encoded this time in the file extension. Redundancy again; the file type is therefore displayed in three ways in list view (“Kind” column, icon, file extension) and in two ways in icon view (icon, file extension).

All of this gives the UI several degrees of freedom. How is this freedom spent? In at least two ways:

  1. To allow for one or more of the channels through which file type information is communicated to be disabled or repurposed in certain circumstances, with minimal loss of information. (An example of a disabled channel: the “Kind” column is absent in icon view, but file type information is still visible. For an example of a repurposed channel, see the notes on Figures 5–9, below.)
  2. To compensate for unreliability of some or all of the channels through which file type information is communicated. Sources of unreliability include:
    • The Finder may not recognize some obscure file types (the “Kind” column would then display no useful information); the file extension may be the only source of file type data in this case
    • The file extension may be missing (but Finder attributes may be set, thus allowing an appropriate icon to be shown and an appropriate value to be displayed in the “Kind” column)
    • The file icon channel may be repurposed (Again, see the notes on Figures 5–9, below, for an example)

(2) List view allows sorting. (Click on a column name to sort by that column's value; click again to reverse the sort order.)

… or is this really a difference? Actually, files can be sorted in icon view as well (there is both a “one-time sort” option and a “keep sorted by…” option). This is not obvious, because the UI for sorting in icon view is not discoverable by mere physical inspection, whereas in list view the column headers are visible, the sort order indicator is visible (the triangle, pointing up or down), and the “click column header to sort tabular data by that column's value” is a well-known idiom. (In icon view, sorting is done via a menu—either from the menubar, or from the context menu, or from a menu in the window toolbar.)

There is, however, a more subtle difference: in icon view it is not possible to sort in reverse order. Why not? The only reason is that Apple was unable (or unmotivated) to design a good UI for reversing sort order in icon view.

General lessons:

  • The same (or analogous) forms of interaction with the data may be implemented via different UI designs in one view vs. another view.
  • If the UX for a particular interaction in one view is obvious, don't assume that in other views it's impossible to design and implement.
  • However, not all interactions that are possible in one view need to be (or can be) available in all views. (It makes little sense to provide “one-time sort” functionality in list view.)

Design principles:

  1. In each view, provide as many interactions as is reasonable, no more and no less. (Provide more and you clutter and complicate the UI; provide fewer and some or all of the views will be too capability-poor to be useful.)
  2. Strive to have each view provide as complete a set of interactions with the data as possible.
  3. To reconcile the tension between the above two design principles, remember that it's better to provide a capability and hide it away behind a non-obvious or non-trivial-to-discover UI than not to provide it at all. This way, it will be available for power users but will not trouble less experienced users. (Of course, this is not an excuse to hide capabilities behind non-obvious UIs when there's a good reason, and a good way, to provide an easily-discoverable UI for them.)
  4. At the same time, look for ways to exploit the unique properties of each view to provide additional interactions that would impossible or nonsensical in other views.
  5. The more ways the user can interact with the data, the better.

(3) Icon view allows arbitrary grouping and arrangement; I can position the files in the window wherever I like (example 1, example 2, example 3, example 4, example 5).

(Unless a “keep sorted by…” option is enabled.)

Some file managers don't have this feature; the Finder does. The lesson:

Do not carry over UX/interaction limitations necessitated by one view, to another view where they are not necessary.

Arbitrary grouping and arrangement makes little sense in list view. In icon view, there's no reason not to permit it—except, of course, that allowing the user to set, and then tracking, arbitrary icon positions, takes work! Does it offer a benefit? Find out! Ask users, survey other implementations, etc. In general, users resent limitations on their freedom, and appreciate the lack of them.

(4) What aspect(s) of the data may be easily gleaned via visual inspection differs from one view to another.

Different views (usually) look different. It's easy to forget this, but it's crucial. Here (in the “Finder list view vs. Finder icon view” example) this manifests in a couple of ways:

  1. In list view, it's easier to pick out files which differ from the others in any displayed metadata value (modification date, file name, etc.). This is true not only due to the sort feature, but also because humans find it easy to scan down a list of text items (which are horizontally aligned) and notice ones which stand out.
  2. In icon view, the "file icon" data channel is wider (because the icon is displayed at a larger size); more data is coming through this channel. This makes it easier to distinguish icons, but also allows this channel to be used for other purposes (see notes on Figures 5–9, below).

General lessons:

For humans, the visual channel is a high-bandwidth one. Use it. Some ways to optimize UI visual bandwidth:

  • Multiplex meaning.
  • Allow the repurposing of high-bandwidth components.
  • Remove obstacles to visual apprehension of patterns (minimize "non-data ink", etc.).
  • Assist the brain's pattern-recognition abilities by using alignment, contrast, repetition, and proximity cues.

The same folder as in Fig. 1 and Fig. 2, but now in column view (Fig. 3) and cover flow view (Fig. 4):


Figure 3. Finder window in column view. Miscellaneous files.

Figure 4. Finder window in cover flow view. Miscellaneous files.


Figure 5. Finder window in icon view. Folder containing low-resolution icons.

Figure 6. Finder window in list view. Folder containing low-resolution icons.

Figure 7. Finder window in list view. Folder containing high-resolution icons.

Figure 8. Finder window in icon view. Folder containing high-resolution icons.

Figure 9. Finder window in icon view, zoomed to cover most of desktop. Folder containing high-resolution icons.

Figure 10. Finder window in list view. Miscellaneous files. No toolbar.

Figure 11. Finder window in list view. Miscellaneous files. One folder expanded to depth 1.

Figure 12. Finder window in list view. Miscellaneous files. One folder fully expanded.

Example two: Microsoft Word document windows


Figure 13. Word document window in draft view.

Figure 14. Word document window in print layout view.

Example three: structured data

  1. A .csv file, displayed as plain text
  2. The same .csv file, opened in Excel
  3. An HTML file, containing the same data, plus markup such that the data will be displayed in tabular form, displayed as plain text
  4. The same HTML file, rendered in a browser

(Analysis of examples two and three left as exercise for the reader.)

January 07, 2020

Three levels of mastery

I’ve never seen this concept named, or concisely articulated, anywhere else. The idea itself is not original to me, of course.


Of any skill, or any domain where expertise of execution may be gained, there are three levels of mastery.

At the zeroth level, you break the rules, because you do not know the rules. Success is accidental; failure is likely; excellence, all but impossible.

At the first level, you know the rules, and follow them. You do well enough, though excellence is unlikely.

At the second level, you know, not just the rules, but the motivations behind them; you understand why the rules must be as they are. You follow the rules or break them, as the task demands; your actions are governed by deep principles. Success is near-effortless; excellence becomes possible, and even likely.


To achieve greater mastery, you cannot skip levels. At the zeroth level, you may look at one who has achieved the second level of mastery, and note that he routinely breaks the very rules he has instructed you to follow. Are there no rules, then? But there are; and they exist for good reasons. You will not achieve the second level of mastery before the first.

Likewise, the one who has achieved the second level of mastery says to him who has yet to achieve the first: “Do as I say, not as I do”. This is not hypocrisy. One who does not understand the three levels may think: “He is allowed to break the rules, as I am not, because of some privilege of rank”. But it is only that to think outside the box, you must know the shape of the box, its contours; if you cannot see the box, you will never escape it.

And once more: you cannot explore the space of possibilities, if you do not know its dimensions. The axes of that space are not the bars of a cage, but signposts; not seeing them, you are not infinitely free—but only doomed to wander forever in a Flatland of amorphous mediocrity.

March 27, 2019

“Screen serif” fonts

There’s a small-ish cluster of serif fonts—all of recent design, not digitizations of classic typefaces, nor even designed for (professional) print1—that people always have trouble fitting into one of the traditional categories of serif typefaces.

In appearance, it looks something like if Baskerville, a 225-year-old typeface that has been shown to shape our perception of truth, and Caecilia made a baby.

The Kindle Finally Gets Typography That Doesn’t Suck

These fonts are sort of like transitional serifs, but they’re also sort of like slab serifs, and sometimes they’re called “transitional serif but with features of a slab serif”2 etc. etc.

… a crisp, modern serif typeface … avoids the stuffiness of historical text faces and doesn’t overreach when it comes to contemporary detailing … a balanced, low-contrast typeface with economic proportions…

Elena font description

Fonts in this category share these properties:

  • fairly thick strokes in the normal weight
  • low stroke weight variation
  • serifs that are not sharply tapering nor thin and dainty, but thick (yet not geometric or square, as slab serifs)
  • relatively open counters
  • relatively large x-heights

… simply a contemporary body text font.

Tuna font description

Fonts in this category include:

… and quite a few more more—see the full list (that I’ve found so far) on my wiki (and feel free to suggest additions on the Talk page!).

Some samples:

The category does not seem to have any accepted name3—yet unquestionably this is a real cluster in font-space. This blog post is meant to call attention to the cluster’s existence.

The characteristics listed above mean that fonts like this will render well across a variety of environments, software and hardware. And empirically, these fonts make for pleasing and readable body text on the web. So, at least for now (unless and until someone tells me that there’s already an accepted name), I’m calling these fonts “screen serif” fonts.

If you want your pages to be readable and attractive, try setting your body text in one of these fonts! (Again, check out my wiki for the full list—I’ll be adding more “screen serif” fonts to it as I come across them.)

1 Some of them—notably including the oldest font I’ve found that belongs to this category, Charter—are designed for consumer printing situations, i.e. laser or even inkjet printers.

3 It’s not the same as Clarendon-type fonts—though there is a good bit of similarity. In fact, Fonts.com includes Charter in the Clarendon category, but that seems to be a minority view.

June 09, 2018

A UX design puzzle for fans of SimTower

SimTower was an elevator simulation game.

OK, it actually had other things in it, not just elevators. But the elevators were the heart of it—they were the most engaging part of the gameplay, with the most complex game mechanics—and, more than anything else, it was mastery of the elevator design that would bring a player success in SimTower.

I played SimTower a lot when I was younger. Read more...

May 28, 2018

Shared interests vs. collective interests

Suppose that I, a college student, found a student organization—a chapter of Students Against a Democratic Society, perhaps. At the first meeting of SADS, we get to talking, and discover, to everyone’s delight, that all ten of us are fans of Star Trek.

This is a shared interest. Read more...

May 06, 2018

Everything I ever needed to know, I learned from World of Warcraft: Incentives and rewards

This is the second in a series of posts about lessons from my experiences in World of Warcraft. I’ve been talking about this stuff for a long time—in forum comments, in IRC conversations, etc.—and this series is my attempt to make it all a bit more legible. I’ve added footnotes to explain some of the jargon, but if anything remains incomprehensible, let me know in the comments.

Previous post in series: Goodhart’s law.


“How do we split the loot?”

That was one of the biggest challenges of raiding in World of Warcraft.Read more...

May 03, 2018

Everything I ever needed to know, I learned from World of Warcraft: Goodhart’s law

This is the first in a series of posts about lessons from my experiences in World of Warcraft. I’ve been talking about this stuff for a long time—in forum comments, in IRC conversations, etc.—and this series is my attempt to make it all a bit more legible. I’ve added footnotes to explain some of the jargon, but if anything remains incomprehensible, let me know in the comments.


World of Warcraft, especially WoW raiding1, is very much a game of numbers and details.

At first, in the very early days of WoW, people didn’t necessarily appreciate this very well, nor did they have any good way to use that fact even if they did appreciate it. (And—this bit is a tangent, but an interesting one—a lot of superstitions arose about how game mechanics worked, which abilities had which effects, what caused bosses2 to do this or that, etc.—all the usual human responses to complex phenomena where discerning causation is hard.)

And, more importantly and on-topic, there was no really good way to sift the good players from the bad; nor to improve one’s own performance. Read more...

April 10, 2018

Five cheesecake tips

Five quick tips for perfect cheesecakes:

Room temperature ingredients

Cream cheese, sour cream, heavy cream, eggs, and so on—all of these should be allowed to come up to room temperature, before mixing them to make the cheesecake batter. Read more...

April 09, 2018

Traps in tabletop RPGs

Why traps?

Traps often seem like they exist to do the following:

  1. Force the players to say "we check for traps" (or convince/threaten their DM into accepting "we are constantly and always checking for traps!" as a valid "standard operating procedure").
  2. Slow down the party's progress, due to constantly and always checking for traps. (This allows the DM to make more wandering monster checks, thus affording more opportunities to cackle with sadistic glee when the party is jumped by a … <rolls d20> … "no encounter".)
  3. Punish players who don't do #1, by inflicting gruesome injury on their characters, and forcing the party cleric to spend valuable spell slots to heal them.
  4. Force someone in the party (inevitably, the hapless rogue) to spend ranks on Disable Device (the other use of the skill—opening locks—is fully subsumed by the knock spell, rendering rogues useless, although of course they were already useless, right?).
  5. Reduce the party's successful negotiation of the fearsome dungeon hazards known as traps—those intricate brainchildren of the dungeon creator's fiendish intellect—to simple, unadorned die rolls (Disable Device again). How good are you at rolling high numbers on a d20? Pretty good? Great, you can advance through the dungeon. Not so good? Sorry, you have to keep rolling until you roll a high number. But if you roll low enough, something terrible may happen to your character!

Some of the above is true, some of the time. Sometimes it's not. But it usually feels true. Why? Read more...