“Code”: Mass Noun versus Count Noun

15 June 2010 @ 10:45
 in Opinion

In English, there are generally two ways of describing quantities: mass nouns, and count nouns. Count nouns are used when the quantity in question is a set of discrete items. “There are twelve bananas.” Here, ‘bananas’ functions as a count noun, which is appropriate because you can clearly tell where one banana ends and the next begins. In contrast, mass nouns are used when the quantity is continuous and not divisible into countable units. “There are twelve peanut butters,” for example, does not make sense. What constitutes a single “peanut butter”? Unlike with a count noun, a unit is required to refer to a specific quantity of a mass noun, even if the unit is implicit, such interpreting the previous example to mean “There are twelve jars of peanut butter.”

This brings me to the word “code”.

Used in its computer programming sense, “code” is always a mass noun in English: “I stayed up writing code until midnight.” “I had to read through four thousand lines of code to find the bug.” “Dammit, what is wrong with all of this code now?” Code is thought of as an continuous mass. Code is what you pour into the engine of your computer to make it run. Aside from the very first few instructions that run as part of your system’s bootstrap, no code stands alone, and you can’t divide code without encompassing it in some larger concept. You can have “two programs” but you can’t have “two codes.”

This sense of the word “code” likely derives from the older sense in which “code” is a synonym for “protocol”, or “structured communications mechanism”, e.g. “Hamming code“, or “Morse code“. Code is the protocol which the programmer uses to communicate with the computer. It has a usually rigid syntax, and its purpose is to give the programmer a mechanism for specifying what he or she wants done in a manner that a dumb box of circuits can make sense of. Code is a series of very clear, unambiguously meaningful instructions.

But the word “code” has other definitions. One is a synonym for “laws” or “rules”, but the other, as listed in Merriam-Webster online, is

3 b: a system of symbols (as letters or numbers) used to represent assigned and often secret meanings

Of all the meanings of the word “code”, this is the only one that functions as a count noun: “What is the code to open this lock?” “During World War II, British spy agencies cracked dozens of German codes.” “The teenage girls devised four different codes to use in passing notes.”

This is why it always disturbs me just a little when I read programming questions or discussion in which someone uses “code” as a count noun: “Please send me the codes.” “What are the codes for displaying a context menu?” “What is wrong with these C++ codes?” I’m sure many of these are simply non-native English speakers who are doing their best to work in this baroque tongue of ours, but I can’t help but shake the feeling that some of these people are native English speakers who are conflating the two senses of the word “code”.

The reason that this disturbs me is not because it’s some grammar peeve of mine. Rather, I suspect that native or fluent English speakers who use “code” as a count noun are subtly revealing their perception of code as something secret and unknowable. For example, the aspiring programmer who asks “What are the codes for displaying a context menu?” might be thinking that there is some particular set of magical incantations hidden somewhere in a dusty, forgotten tome which need to be recited precisely in order to conjure up a context menu. Similarly, one who requests that I, “please send [him] the codes,” is more than likely not interested in understanding how to accomplish the task he is asking about, but is instead interested in obtaining what he sees as an opaque sequence of characters that, when compiled, will make the computer do what he wants.

In short, the use of “code” as a count noun, rather than a mass noun, and when not explainable by imperfect mastery of the English language, is a potential red flag for impending cargo cult programming (which I consider one of the biggest issues in Computer Science education, and have complained about before).

3 Comments »

  1. Right, we all learned this as kids: I just learned the cheat codes for 30 lives and the blood mode… now these games are way better.

    Comment by Will Entriken — 21 June 2010 @ 14:41

  2. I was reading this weeks issue of Nature, and an article there (http://www.nature.com/news/2010/101013/full/467775a.html) repeatedly makes this mistake… And so do some of the commenters. Is it possible there’s a British vs american distinction here, or does it seem more likely to you that the author just isn’t much of a coder?

    Comment by Peter Combs — 17 October 2010 @ 01:13

  3. I don’t think it’s a British vs American distinction so much as one between science/engineering and the rest of the software world (http://stackoverflow.com/a/2774260/117911).

    Comment by Bernd Jendrissek — 22 April 2014 @ 12:15

RSS feed for comments on this post. TrackBack URL

Leave a comment