73

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

I shall use these codes.

  • 29
    "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 Apr 11 '11 at 5:48
  • 2
    the above comment obviously should read "programmer wannabe"... – nico Apr 11 '11 at 8:34
  • 8
    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 Apr 11 '11 at 14:47
  • "I shall use these scripts" is more likely what a programmer would say. – zzzzBov Apr 11 '11 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 Oct 3 '12 at 7:48

10 Answers 10

121

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.

| improve this answer | |
  • 1
    You used "these codes" in your example, is that correct then ? – Shrinath Apr 11 '11 at 6:26
  • 5
    @Shrinath: Only in the sense of security codes, not programming code. [Which is a mass noun.] – Orbling Apr 11 '11 at 7:21
  • 3
    Where's that quoted definition from? Please do not forget to indicate your sources. – RegDwigнt Apr 11 '11 at 9:27
  • 13
    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 Apr 11 '11 at 10:50
  • 23
    @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" (-: – hippietrail Apr 11 '11 at 11:53
47

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.

| improve this answer | |
  • 3
    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. – Scott Mitchell Apr 12 '11 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". – Nike Dattani Sep 8 at 19:11
12

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.

| improve this answer | |
10

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."

| improve this answer | |
  • 5
    Although algorithms would be a more appropriate term in that case. – nico Apr 11 '11 at 10:17
  • 7
    Definitely, codes is not valid in that example – Kieren Johnstone Apr 11 '11 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. – John Machin Apr 11 '11 at 22:29
  • 1
    @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 Apr 11 '11 at 22:58
  • 3
    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 Apr 12 '11 at 5:52
10

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.

| improve this answer | |
  • Be careful when saying "always". – Nike Dattani Sep 8 at 10:28
9

"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.

| improve this answer | |
  • 1
    @Adam: See updated answer for some examples. Usage in document titles is not that common, but in the running text is not unusual, nor is considered an error. I hope this is convincing enough for you. – Martin Tapankov Apr 11 '11 at 14:21
  • 4
    @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. – Martin Tapankov Apr 11 '11 at 14:25
  • 7
    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 Apr 11 '11 at 15:02
  • 8
    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 Apr 11 '11 at 22:29
  • 4
    "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. – Lubo Antonov Mar 13 '14 at 12:45
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.

| improve this answer | |
  • 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. – Nike Dattani Sep 7 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.) – Edwin Ashworth Sep 7 at 14:37
  • @NikeDattani, example, pretty please :-) – Jesse Steele Sep 7 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 Steele Sep 7 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 – Nike Dattani Sep 7 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.

| improve this answer | |
0
+50

This is getting a little silly. 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.

| improve this answer | |
  • +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. – Nike Dattani Sep 7 at 17:59
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.

| improve this answer | |
  • 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. – Nike Dattani Sep 7 at 17:30

Not the answer you're looking for? Browse other questions tagged or ask your own question.