Is it wrong to use the word "codes" in programming context?
I shall use these codes.
English Language & Usage Stack Exchange is a question and answer site for linguists, etymologists, and serious English language enthusiasts. It only takes a minute to sign up.Sign up to join this community
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.
Yes, it is wrong to use the word "codes" in the programming world if source code is implied:
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.
"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.