[SIGCIS-Members] Origins of "clean" code

thomas.haigh at gmail.com thomas.haigh at gmail.com
Fri Sep 3 15:55:32 PDT 2021


Hello Azhar,

It's an interesting question. I don't have any definite pointers for you, but here are some ideas.

First, you could look in the ACM or IEEE digital libraries with date filters set for early uses of the word "clean" or the phrase "clean code" or several variants in it. Second, you could search Google books for the phrase "clean code." In some cases the Oxford English Dictionary is useful, but this is not a distinct new sense of the word "clean" so there is no entry. 

Second, you could dig into the metaphor. Phrases like this often start out as explicitly metaphorical, like computer memory, and become naturalized. What did it originally mean for code to be "clean". In early use, what was the opposite of "clean." Did people talk of "dirty code"? "Messy code?" Somehow "messy" or "tangled" seem more appropriate than "dirty" which is the usual antonym of clean. "Clean" and "dirty" are used together in respect of caching techniques, but that is not quite the same sense.

Dijkstra does seem to have been fond of the word "clean." One of the earliest hits in my own database of sources and notes was EWD 32 on "advanced programming," which includes both "the clean and systematic structure of the translator" and "the clean and systematic structure of the machine itself."  https://www.cs.utexas.edu/users/EWD/transcriptions/EWD00xx/EWD32.html So it seems plausible that the metaphor comes, or was at least popularized, out of the structured programming movement of the early 1970s. In this case Dijkstra was explicitly equating the design of programs with the design of machines.

In light of the connection of cleanliness with structure and elegant mechanisms, you might also consider the historic association of cleanliness and efficiency with systematization. One of my dissertation advisors, Mauro Guillen, wrote a book _The Taylorized Beauty of the Mechanical: Scientific Management and the Rise of Modernist Architecture_ that made an interesting case for Taylorism as a kind of aesthetic preference that had a lot in common with minimalism. And of course Taylorism was just one of many managerial movements based around systematization. More generally, say, management reformers called for the adoption of desks with no drawers or built-in compartments so that papers could not accumulate.

The place where "dirty code" does seem to be used is in a special context, as "quick and dirty code" which is a more general formulation used in many design areas. But here too, it seems to go with the assumption that "clean" code is well structured and elegant.

Best wishes,

Tom

-----Original Message-----
From: Members <members-bounces at lists.sigcis.org> On Behalf Of Azhar Desai
Sent: Friday, September 3, 2021 2:19 PM
To: members at sigcis.org
Subject: [SIGCIS-Members] Origins of "clean" code

Hi SIGCIS,

I'm a software engineer,  who reads & relies some of your work, to help make sense of working in the astonishingly ahistorical tech sector - so thank you!

I'm interested in the origins of the word "clean" in software design. In conversations about software, people might often prefer some code over another, arguing that it's "cleaner". An example from a 2020 paper on the implementation of a VPN in Linux:

> While the Linux kernel’s crypto API has a large collection of primitives... ultimately, using raw primitives with direct, non-abstracted APIs proved to be far cleaner [1] 

The most famous example is the eponymously titled book "Clean Code" (2008) which proposes snippets of code that are ostensibly always preferred.

Does anyone know where I might find out how the word "clean" came to be used like this in software? My reasons for asking are somewhat impure: I'm trying to discourage this not very meaningful word in favour of more precise language.

One of the earliest uses I've seen of "clean" is in one of Djikstra's notes from 1974 [2] on a design for arrays in response to how ALGOL 60 had it. [2] But I have no idea if it was in common use then, or had always been in the development of programming languages at least. I'd love to hear any thoughts.

Best,
Az

[1] https://www.wireguard.com/papers/wireguard.pdf
[2] https://www.cs.utexas.edu/users/EWD/ewd04xx/EWD417.PDF
_______________________________________________
This email is relayed from members at sigcis.org, the email discussion list of SHOT SIGCIS. Opinions expressed here are those of the member posting and are not reviewed, edited, or endorsed by SIGCIS. The list archives are at http://lists.sigcis.org/pipermail/members-sigcis.org/ and you can change your subscription options at http://lists.sigcis.org/listinfo.cgi/members-sigcis.org




More information about the Members mailing list