Wherefore/whence the incorrect grammatical use of "code" ("a code was written")?

I've noticed a seemingly increasing number of students now refer to the end result of programming to be "a code" rather than "a program", "a script", or even "some code". For example, taken from a report I'm currently reading:

Next, code was written to put all of the values in SI units. […] A new code was then written just to provide the density outputs […]

The first use of the word "code" I'd consider to be correct; the second not. (It goes without saying that they're not referring to literally a single command given to the computer.) My impression is that this error is a new mistake that "kids these days" are making for some reason.

This leads me to wonder:

  • Is this actually a new error that students are making, or have I just not hung out enough in the past with people that don't know how to refer to programming? (This might not be possible to answer.)

  • But on a more basic level, what is causing people to make this mistake in the first place? The use of the word "code" to me seems quite natural but evidently it's not (or is no longer).


Solution 1:

In programming jargon the first use ("code was written") is clearly correct while the second use ("a new code was written") is incorrect.

However, I suspect that this use of the word "code" is the strange one from a broader linguistic perspective.

When the word "code" is used in regular language (meaning "a collection of rules" or some variation of that) it is entirely correct to say "a code" (e.g. "a code of conduct", "a building code", "a code for telegraph communication").

So in regular language use "code" is a count noun but in programming jargon it is a mass noun.

This entry for the word "code" in The Jargon File shows that this conflict is well established:

  1. n. The stuff that software writers write, either in source form or after translation by a compiler or assembler. Often used in opposition to “data”, which is the stuff that code operates on. Among hackers this is a mass noun, as in “How much code does it take to do a bubble sort?”, or “The code is loaded at the high end of RAM.” Among scientific programmers it is sometimes a count noun equilvalent to “program”; thus they may speak of “codes” in the plural. Anyone referring to software as “the software codes” is probably a newbie or a suit.