nouns - A code or some code?
When talking about the source code of a program, my Computer Science teacher sometimes refers to single pieces of code as 'a code'. For example:
For today's task, you need to write a code which outputs "Hello World".
I feel that this is terribly wrong as I would say 'some code' or 'a piece of code'. E.g.:
For today's task, you need to write some code which outputs "Hello World".
Who is right, me, my teacher or both of us?
Answer
"Code" as usually used in the field of IT refers to source code of computer programs. My own intuition is that this is clearly uncountable, so you can speak of "some code" but not "a code". You can also speak of "the source code of a program", which means "the [representation of the program] as source code". However, "code" alone remains uncountable. You could speak of "a code" when used in a different meaning, such as: "he gave me a code with which I could open the locked door" (here "code" is a "hard-to-guess combination of letters/digits").
While Merriam Webster doesn't state anything about the countability of "code" used as shorthand for "source code", Wiktionary gives one of the meanings as synonymous with source code, machine code or bytecode, and these are described as uncountable.
Bytecode is described as countable and uncountable, and while it is not explicitly stated, it seems logical for bytecode (the byte representing a single instruction) to be countable and bytecode (a series of instructions represented as bytecodes) to be uncountable. I wouldn't object to using "a bytecode" in context such as: "this function consistes of a single bytecode", but "bytecode" in the latter meaning would behave like "source code" or "machine code" and be uncountable.
Comments
Post a Comment