Member-only story

Code as communication: mental models & expectation management

John Ohno
5 min readJan 1, 2019

Communication is a useful lens for thinking about programming, because it clarifies certain things about good style left unaddressed by competing models (like programming-as-instruction or programming-as-engineering). Programming is a unique kind of communication, though.

A program has two distinct audiences: human beings (who are expected to understand the intent of the code, its actual behavior, and how the two are related) and computers (who are expected to execute the instructions in a consistent manner). The most important constraint a programmer must optimize for is to ensure that the intended behavior, a human’s expectation of actual behavior, and the actual behavior as interpreted by any computer, are as close to identical as possible. This is a bit unusual: many forms of communication are targeted at a single audience (or a contiguous range of people), and those that are intended for disjoint audiences are often intended to mean something different to one than do the other (like a dogwhistle). The only kinds of code intended to have a hermenuetic double-meaning are malware and joke projects (like entries into the Obfuscated C contest).

The second most important constraint is that the effort for a human being to come to a reasonable hypothesis about expected behavior should be minimized. (In this way, maintenance is made easy.) This is also unusual: stories and especially jokes derive their power from misdirection and from hidden depths. Dramatic irony is a code smell: if…

--

--

John Ohno
John Ohno

Written by John Ohno

Resident hypertext crank. Author of Big and Small Computing: Trajectories for the Future of Software. http://www.lord-enki.net

No responses yet