16

I'm a programmer and I often see the abbreviation ID (capitalized) in technical documents and code. Is this correct, or should it be id?

  • Capitalization (in code) is specific to the conventions of the programming language, not the language used for naming the variables (usually English). In C#, you'd encounter Id for a public property, id for a local variable, _id for a private property, and ID for a constant value. For technical documentation, it varies: if you're referring to a code variable/property/const, then you should use the same capitalization. – Flater Oct 13 '17 at 9:27
  • @Flater - If you want to see real fireworks, migrate this to a programming Stack Exchange. I bet it would engender passionate responses. – iMerchant Oct 13 '17 at 9:44
  • @iMerchant: Regardless, those passionate responses would all be advocating the use of different capitalizations for different circumstances (even if they can't agree on which to use where). – Flater Oct 13 '17 at 10:05
  • Agreed. Ideally the OP would clarify which language he is using. But since his question is nearly five years old and he’s only accumulated 61 rep points in the meantime, it’s safe to assume he is long gone and any of our comments/answers are moot at this point. But hey, it’s still fun to comment regardless. As for the fireworks, who doesn’t like watching fireworks? – iMerchant Oct 13 '17 at 10:17
17

In English, both letters should be capitalized ("ID"). The lower case word "id" has a specific meaning that does not invoke the meaning "identifier," or "identification." In documentation it should be spelled out (ID abbreviates two different words, after all), or be in all caps.

However, programming languages are not exactly English. Styles vary widely. The de facto standard nowadays seems to be CamelCase, in which even identifiers such as acronyms capitalize the first letter only:

Id, myId, aSpecificId

But the whole question is prone to "religious wars" in the programming world, and there is no definitive answer. Some insist that the first letter always be capitalized, some the first letter only of following words (sometimes known as "camelCase" to distinguish from "PascalCase").

  • Thanks. I'm not concerned with the programming world so much, but proper English usage. (BTW -- most C/C++ libraries do NOT use camel case style, so I would not say this is NOT the de facto style standard...) :-) – Jeremyx Jan 23 '13 at 20:15
  • The "C-style" programming style is to lower-case the first character of variable names, upper-case the first character of class names. (Of course, Microsoft does not follow this de-facto industry standard, but pretty much everyone else does.) – Hot Licks Feb 24 '15 at 16:51
  • 2
    ID abbreviates identification. Which other word? Indonesia? – Synesso Jul 24 '15 at 2:04
  • @Synesso He means that "id" is itself an English word. See Freud's id, ego and super-ego. – Dan Apr 27 '16 at 20:06
  • 3
    In terms of programming capitalising both seems odd to me. It's not usually NOT an acronym for "identity document" or similar in these contexts, it's simply an abbreviation of "identifier" as it's usually a number or string. I think this is why it's very commonly camel-cased. – Thor84no Aug 19 '16 at 8:54
8

I agree common usage is ID. This is because ID is an abbreviation for identity document. So when ID is used for identifier it has an understood meaning. Language does evolve in this way.

On proper English. Identifier is only one word so I choose to use Id. Such as PhD, Mr, Ms, SciFi, Jr, Sr, Lt, Lt Col, and Prof. I'm sure more examples can be found.

The only counter example I can find is TV and even then I wouldn't be surprised if it evolved as well from a hyphen or two words.

If you're programming, as most people searching for this are, the way you spell it in code is determined by the coding standards put forth by your architect or lead.

Edit: Changed word acronym to abbreviation. The content still maintains such as in GMO, genetically modified organism. If anyone doesn't believe Identity Document is a thing, https://en.wikipedia.org/wiki/Identity_document where it will show that ID is used as an abbreviation for Identity Document.

  • Didn't realize it stood for identity document. Brilliant! – ostrokach Sep 26 '17 at 18:03
  • You should probably edit to account for the fact that "ID" actually "Identity Document"? There's an edit link below the question. – Solomon Ucko May 22 '18 at 23:47
  • "Identifier" and "identity document" aren't the same thing. However this great answer does service to both usages. – Jirka Hanika Jul 11 '18 at 15:54
  • I'd add that "identifier" is a technical term, plenty of industry standards use it (frequently written as "id" or "ID", I wasn't able to find a standard capitalizing as "Id"), and one can often locate the closest applicable standard and follow its practice in similar cases. Furthermore, be sensitive to whether the context is actually English prose, table heading, a programming language with its own capitalization rules, etc. – Jirka Hanika Jul 11 '18 at 15:54
3

In common English, ID is used from common practice. In programming, though, it's sometimes id. The reason it's capitalized for common English is that there's no period at the end of the abbreviation, unlike abbreviations like tsp., lb., or abbr. Abbreviations also see demotion from capitalization by common use. Capitalization in programming isn't dictated by capitalization in common English but instead by the group of programmers. PascalCase or camelCase or snake_case, it comes down to preference and convention in the language.

  • 1
    I am a programmer, and have been for decades, but I have never once used id. Not even in source code, let alone in the documentation. It's always ID. Same for my colleagues. So I'd like to see your statement backed up with actual data. Otherwise it's just your anecdotal evidence vs. my anecdotal evidence. – RegDwigнt Jan 23 '13 at 21:16
  • Hard thing to find. It must be just anecdotal evidence. I'd never seen id capitalized ID before, but almost all of my experience in programming has been academic, either research programming or otherwise academic programming. It may be one of those academic vs corporate coding differences I seem to discover all the time. – calben Jan 23 '13 at 22:40
  • 2
    I don't think you're going to get much anything other than anecdotal 'evidence' on this one though. The answer to the original question is that it can be either. I've seen more of id in my programming experience. – calben Jan 23 '13 at 22:43
  • The Java libraries (which became something of a de facto standard) use mixed case even for acronyms that are usually all caps. So: transactionId, cf. siteUrl. C and C++ programmers not influenced by Java would have transactionID or transaction_id, or, for the hard core, x. My preference is for the all caps version even in Java. Outside source code I would always set in all caps, to avoid confusion with the Freudian construct. – Andrew Lazarus Jan 24 '13 at 21:29
  • 1
    my id says Id use id, ID, id, id., Id or even iD and most readers will discern the proper meaning – Kirby Aug 23 '16 at 4:02
0
  1. In English: ID has been arbitrarily chosen to be uppercase, only for convenience, only to distinguish it from the other meanings of the word "id". It is not an acronym like SQL, ASCII or NASA. (Strictly speaking it is incorrect, but now it is the convention.)

  2. In programming, if the convention for your specific programming language is requiring camelCase or PascalCase, then you should simply use id or Id (eg: shopId, ShopId), and iD and ID are incorrect. Just like for SQL you should use sql or Sql.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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