88

Is it wrong to use the word "codes" in programming context?

I shall use these codes.

8
  • 33
    "Gimme the codez" has become kind of a meme in the programming world, due to the large amount of wannabe (but not wannalearn) people who invade programming forums saying "Plz gimme the codez for xxxx"... definitely NOT correct English.
    – nico
    Commented Apr 11, 2011 at 5:48
  • 3
    the above comment obviously should read "programmer wannabe"...
    – nico
    Commented Apr 11, 2011 at 8:34
  • 10
    This question is ambiguous. In this context, does 'code' refer to programming language source code, a standard character set like ASCII code, a proprietary security system password code, command line switch code, or some other valid use of the word 'code' as it pertains to software use and development?
    – oosterwal
    Commented Apr 11, 2011 at 14:47
  • 1
    "I shall use these scripts" is more likely what a programmer would say.
    – zzzzBov
    Commented Apr 11, 2011 at 16:54
  • 4
    Whoa! So much talk without even asking the OP what he is referring to by codes? He only said 'in programming context', not 'program' or 'program segment'. Peeps!
    – Kris
    Commented Oct 3, 2012 at 7:48

10 Answers 10

144

As a programmer, I cringe when hearing this!

In computer science, "code" is used as a mass noun, specifying the collection of instructions in a specific arrangement as a whole and in no specific quantity. Whether it's one line of code or ten pages, it is still referred to as code, not codes.

When "codes" is used in computer science, it typically refers to values or constants used to specify a trait, access or properties, though in my experience, the actual name of those types of items is used over the word "codes". For example, instead of:

Use these codes to specify the read/write permissions of the file.

You would write/say:

Use these constants to specify the read/write permissions of the file.

Or: Use this enumeration to specify the read/write permissions of the file.


With regard to the use of "code":

Use this code to open a file.

Use these functions in the source code to access the database.

This program code needs to be tidied up.

14
  • 8
    @Shrinath: Only in the sense of security codes, not programming code. [Which is a mass noun.]
    – Orbling
    Commented Apr 11, 2011 at 7:21
  • 3
    Where's that quoted definition from? Please do not forget to indicate your sources.
    – RegDwigнt
    Commented Apr 11, 2011 at 9:27
  • 15
    Code is used like sand: you can have 1, but you cannot say 1 code like you cannot say 1 sand. You can use more words to specify the amount: 1 line of code --> 1 grain of sand. But like Nick said, you can use codes as a noun, in a container kind of way. When you have access codes, but then you could read that as: I have 3 lines of access code /
    – Terry
    Commented Apr 11, 2011 at 10:50
  • 25
    @Nick Bedford: I'm also a programmer who cringes at "software codes" but "code" is not quite like "fish". Code is a mass noun like in djerry's example "sand" above. Mass nouns refer to stuff which cannot be counted and have no plural in certain senses. "Fish" and "sheep" might be called invariant since they have a plural but it happens to be identical to the singular. You can say "two fish" but not "two code". But "fish" also has other plural uses and mass noun forms too - "twho fishes", "I ate some fish" (-: Commented Apr 11, 2011 at 11:53
  • 2
    For someone wants to use code as countable, the word code snippet(s) is for you. Commented Oct 1, 2017 at 14:17
60

Yes, it is wrong to use the word "codes" in the programming world if source code is implied:

Noun

source code (uncountable)

  1. (computing, uncountable) Human-readable instructions in a programming language, to be transformed into machine instructions by a compiler, interpreter, assembler or other such system.

Uncountable noun (my emphasis): "a noun that cannot be used freely with numbers or the indefinite article, and which therefore takes no plural form".

The same if code refers to a computer program:

(uncountable) A computer program, or more generally, any defined computing process.

In some other contexts it is all right, for example, access codes.

3
  • 7
    To be pedantic, in addition to being incorrect when referring to source code it's also incorrect when referring to other types of code, such as intermediate code and machine code. Commented Apr 12, 2011 at 4:25
  • The question asked about "code" not "source code". Why did you add the word "source"? It seems because "source code" says "uncountable" but "code" says "countable or uncountable": en.wiktionary.org/wiki/code#English. Your last quote does not match what the actual website says. I would recommend that you change this answer to reflect the truth that code can be countable or uncountable and remove the part about "source code" or "access code". Commented Sep 8, 2020 at 19:11
  • 1
    Yes in other contexts it might be correct to use the the term codes.
    – Dong Li
    Commented Apr 21, 2023 at 9:48
15

No, this is not correct when you refer to programming code.

There is no plural when you refer to programming code since when you say code you do mean the whole chunk of it. Even if you say for example "different sets of programming code" you notice that no plural is used.

14

"Codes" is actually correct usage and is quite common in academia and in descriptions of commercial products in fields that utilize numerical methods, such as topology optimization or finite element analysis. It is never used to designate a random program that Joe Coder implemented.

What is really meant by this is "well-known and well-tested libraries that do the job as fast as possible". The complexity of the numerical methods is very high, and since performance and accuracy are critical, the demand on the programming skills of their coders is huge. For this reason, the number of numerical method programming libraries is relatively small, and every self-respecting software product in the field uses one or another.

That being said, I would consider any usage outside this very specific context to be incorrect.

Update: By request, some examples below, from different sources:

Hopefully that's convincing enough. More examples to be had if one searches for "optimization codes", "finite element codes" or similar.

16
  • 5
    @Adam: Also note, the usage of "codes" does not mean "source code" in this case. The "codes" in question are numerical libraries which may be open-source, but may very well be licensed commercially in binary form only. And as I said in my post, any usage besides this very narrow scope is incorrect. Commented Apr 11, 2011 at 14:25
  • 10
    I'll vouch for this answer. In the scientific programming community, 'codes' is a perfectly acceptable plural to indicate multiple pieces of software that are usually manipulative libraries. @Martin Tapankov is definitely correct, in this narrow context.
    – pboin
    Commented Apr 11, 2011 at 15:02
  • 9
    It's certainly true that some scientific communities use the plural like this. Whether that community is "correct" to do so is a different matter...
    – wnoise
    Commented Apr 11, 2011 at 22:29
  • 7
    "codes" is largely used by academics in non-computer fields. Whether this is because they have learned it from others such as them or because they are trying to project an image of competence, it is hard to say. I am yet to meet a computer scientist or a professional programmer that refers to the source of their programs as "codes". Users of this fake plural form should be aware that they come across as pretentious and self-important, yet dilettantish. Commented Mar 13, 2014 at 12:45
  • 3
    it sounds wrong
    – Pup
    Commented Jun 4, 2020 at 19:47
12

It is always wrong to use "codes" when refering to a quantity of "source code". Source code is a mass noun which should never be pluralised.

There are some however some other cases where it is permissible to use "codes" in a programming context:

  • When it is used to describe some form of pre-defined encoding e.g. "HTML status codes 404 and 500 mean page not found and internal server error respectively". Here a code refers to a (singular) element of an encoding so it is fine to pluralise it.
  • When used in a security context, e.g. "access codes". Again, an "access code" is singular so it is fine to pluralise it.

Hence "I shall use these codes" may or may not be correct depending on the context.

1
  • Be careful when saying "always". Commented Sep 8, 2020 at 10:28
11

Generally "code" is a mass noun. At the other end of the spectrum from the "gimme teh codez" crowd, "code" is used as a count noun in some scientific and numerical circles: "I looked at 5 different codes for FFT [Fast Fourier Transform] and didn't like any of them."

10
  • 5
    Although algorithms would be a more appropriate term in that case.
    – nico
    Commented Apr 11, 2011 at 10:17
  • 8
    Definitely, codes is not valid in that example Commented Apr 11, 2011 at 11:54
  • 4
    @Kieren Johnstone: "valid" means that a group of people use and understand the word to mean that. @nico: No, they use it to mean a program/script/subroutine/function which is an implementation of an algorithm ... could be 5 implementations in 1 to 5 different computer languages of 1 to 5 different algorithms. Commented Apr 11, 2011 at 22:29
  • 3
    @nico: Code is an implementation of an algorithm. You can't just substitute one for the other (although the plural word algorithms is used more often, thus feeling more natural, it isn't correct). But code is still uncountable, if you want to introduce count, implementations would be best.
    – Ben Voigt
    Commented Apr 11, 2011 at 22:58
  • 4
    reading your example I immediately thought that you were implying having looked at 5 different ways to perform FFT, so 5 different algorithms. If you want to say that they were written in different languages than, as you say, you should use 5 different implementations to avoid any confusion. Personally I don't hear using the word codes (plural) so much in scientific circles... but there may be regionality in that.
    – nico
    Commented Apr 12, 2011 at 5:52
3
+50

Computer "code" is called that because it consists of a sequence of "opcodes" (operation codes) which specify the actions for the computer to take. Some place early in the evolution of computer jargon an instance of such a sequence came to be called "code", for no well-defined reason -- this is just the way that jargon develops.

But "codes" still exist in computing. In addition to the opcodes, one might speak of the code sequences for the individual sin, cosine, and tangent functions as "codes for the trig functions" -- it's just a matter of what jargon fits the current needs.

And, of course, there are error codes, status codes, codes used in documentation, etc.

And it needs to be noted that while (to the uninitiated) most of these codes are cryptic, they do not involve encryption per se -- totally unrelated from "code" in the cryptographic sense.

1
  • +1. This is my favorite answer so far since posting the bounty. It doesn't even touch on my own peeve with the top-voted answers, which is that "code" is a countable noun when used as a synonym of computer program, for example when talking about the codes GAUSSIAN and MOLPRO. However it introduces us to the history of where the word "code" originated and provides so much more insight such as the existence of other types of codes like error correcting codes and such. Great answer all around. Commented Sep 7, 2020 at 17:59
2

It can be used both ways, based on intended meaning

The answer to this question is found in the "usage".

OP:

Is it wrong to use the word "codes" in programming context?

I shall use these codes.

It depends on what you are referring to, even in programming context.

If you mean a list of passwords, references (eg 'error codes'), a series of long character strings and formulas for computation, or sub-kernel/sub-C level lines used by compilers or interpreters that Bill Joy might use to make binary talk to the hardware, then no, it is not wrong.

If you mean a section of JavaScript, HTML embed snippets, or even multiple Python files, then yes, it would be wrong from an English usage viewpoint.

In the ESL world, we would say that the word "code" in reference to the many lines of, say, a PHP web app or system process written in C is "uncountable". This echoes a concept in another answer about "mass nouns".

English Club:

uncountable nouns are substances, concepts etc that we cannot divide into separate elements

This does not mean that nouns must always be used as only countable or uncountable. Note, that explanation from English Club does not describe "words" themselves as only being either countable or uncountable, but the "substances, concepts" etc nouns may refer to. Take for example "water"...

Uncountable:

He spilled water on the floor.

Countable:

Please bring me a water. (a glass of water)

Minnesota has many waters. (bodies of water)

As a coder myself, if I said, "Use these codes," I would be referring to something like what Google provides, discussed in this linked article, which uses "codes" in the plural as part of the title:

Google:

Sign in with backup codes

Right away, because "codes" is plural, I know this Google article is not a PHP or Python script; it is a group of passwords.

Personally, I don't often say, "codes," in reference to exit codes, though I might; I say, "exit codes," for clarity, largely due to the reasons behind this question.

In the uncountable, "code" is often treated like water, rice, or pasta—they don't have "noun-number" (plural/singular). "Code" in reference to the contents of a software application is like a giant bowl of pasta and each "line" is like a noodle. That imagery could serve as a guide.

I suppose one could say...

Here are the codes you can use on our server.

...in reference to a series of short commands or code snippets, but I think it rather amateur to use the plural countable it that way. And, I might not hire a person simply based on hearing that, whether for teaching English or for a coding job. It would tell me a lot about the quality of English usage the coder would be putting into UX instructions in an app and the lack of exposure the applicant had to experienced people in the industry. But, now I've just crossed into other topics of Workplace and UX.

If I want to use a plural noun to describe "code" in reference outside passwords and encryption keys, I prefer either "commands" or "lines of code" (also known as LOC).


I write partially from my experience, having my own computer course at github.com/inkverb/vip and my own English course with style guides at write.pink. This is how I use the word in my work.

20
  • However "code" in the programming context doesn't only mean "lines of code" it also can have another meaning which is simply a synonym of "computer program" and in that situation it is countable. Commented Sep 7, 2020 at 14:32
  • 1
    '[T]he word "code" is "uncountable" ' displays a misconception that has often been addressed on ELU. In 'My favourite drink is coffee,' coffee is non-count. However, in 'The two most common coffees are arabica and robusta,' and also in 'Two coffees, please,' coffee is count. Saying that a noun is count or non-count (especially when it exhibits both behaviours) is misleading. Noun usages are count or non-count (and even this classification presents problems. 6000 police has broadened in acceptability beyond headlinese, but 3 police is unacceptable.) Commented Sep 7, 2020 at 14:37
  • @NikeDattani, example, pretty please :-)
    – Jesse
    Commented Sep 7, 2020 at 16:32
  • @EdwinAshworth It is about usage, I agree, which was why I addressed both uses. In your wonderful coffee example, I'll expand as someone who walks among coffee trees here in Asia: The long version would be "two most common coffee beans" or "two most common coffee trees", shortening it so that coffee takes the plural. That doesn't correct or change the accuracy of what you wrote, but it does help clarify what is going on as a guide for why one would use coffee, water, or code as non-count or countable. Thanks!
    – Jesse
    Commented Sep 7, 2020 at 16:35
  • 1
    @EdwinAshworth Your explanation of how nouns can be countable in some contexts and uncountable in others, in addition to the statement that saying a noun is "count or non-count is misleading" and that it's usages that are count or non-count, is exactly the type of answer I was looking for when I posted this bounty. I would gladly give it to you if you want to write an answer. Jesse: there's 5 examples here: english.stackexchange.com/a/20490/21450 Commented Sep 7, 2020 at 17:25
1

As Macmillan Dictionary notes, code as used in a software context is either countable or uncountable:

code COUNTABLE/UNCOUNTABLE ​COMPUTING a set of instructions that a computer can understand

Ngrams shows that computer code is currently used about four times more frequently than computer codes:

computer code vs computer codes

The Corpus of Contemporary American English shows the same pattern -- computer code appears in the literature about four times more frequently than computer codes.

However, while another answer asserts that the phrase computer codes is restricted mainly to describe software written for numerical computing, COCA shows about the same distribution of of its use in both mainstream and scientific literature as computer code.

Usage is not definition; while computer code is used more frequently, especially in American English, computer codes is a perfectly valid term for describing a body of software and firmware.

0

Is it wrong to use the word "codes" in programming context?

I shall use these codes.

Actually you can say "1 code " but in a different context. This might be a letter substitution code or a rotating modular code just to mention a few. These are not considered in the current discussion which is a larger problem.

I am with Nick Bedford above in cringing at a computer program's content being referred to as code. Code is meant to purposely hide or obscure the information given. That is characteristic of only the Worst program content. A mistake here is that in rushing to illustrate this opinion we miss (partly) what the original question represents. Any other question like this would demand more context. Here we discuss opinions about the mass noun versus the individual but over look the vagueness of the original question.

My answer to the question would be the same as Nick Bedford's. I did not wish to detract from it, only add some more detail that did not fit in a comment.

1
  • The question is vague, because if you're talking about "lines of code" the word "code" is uncountable but if you're talking about the codes GAUSSIAN and MOLPRO then it is countable. You are right that people were mistaken by rushing to illustrate their opinion on a question that was extremely vague. I can't give you an upvote though because I can't figure out what your answer is to the question of whether or not it's okay to use the word "codes" in a programming context. My bounty is particularly aimed at going to an answer that gives the perspective that "codes" can be okay in some contexts. Commented Sep 7, 2020 at 17:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .