Is it wrong to use the word "codes" in programming context?
I shall use these codes.
Is it wrong to use the word "codes" in programming context?
I shall use these codes.
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.
Code
is a mass noun
like in djerry's example "sand" above. Mass noun
s 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
code
as countable, the word code snippet(s)
is for you.
Commented
Oct 1, 2017 at 14:17
Yes, it is wrong to use the word "codes" in the programming world if source code is implied:
Noun
source code (uncountable)
- (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.
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.
"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.
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:
Hence "I shall use these codes" may or may not be correct depending on the context.
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."
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.
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".
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:
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.
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:
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.
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.