33

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?

Jeremyx
  • 431
  • 3
    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 09:27
  • 4
    @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 09:44
  • 1
    @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
  • 1
    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

6 Answers6

34

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

shipr
  • 1,756
  • 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
  • 4
    ID abbreviates identification. Which other word? Indonesia? – Synesso Jul 24 '15 at 02: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
  • 6
    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. – Vala Aug 19 '16 at 08:54
  • 2
    Yes, as @Synesso asks, what is the other word in included in the so-called acronym? In English we have many homonyms, and we don't artificially capitalise one variant to differentiate it from other variants. Although, I must admit I'm a software developer, and the all upper case version annoys the crap out of me, and interferes with word separation in longish class,property, function, etc. names. – ProfK Sep 13 '16 at 02:51
  • 1
    The de facto standard nowadays seems to be CamelCase. More often than not, there are different capitalizations (in the same language) based on what sort of variable you're trying to name. 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. – Flater Oct 13 '17 at 09:30
  • 1
    Re. English language:
    1. "id" meaning "part of the mind" should not be capitalized.
    2. "ID" meaning abbreviation for "identifier" or acronym for "identifier document" should be capitalized...
    – Tom Oct 17 '18 at 22:11
  • Re. IT Identifiers: For English meaning #:

    1:

    1.1. "id" (if at start of normally lower-cased Identifier, i..e. Local / Private Variables / Methods, or any time it's not the 1st word), else 1.2. "Id".

    2:

    2.1. "ID" if in Identifiers where words / acronyms are typically separated by a space / punctuation (i.e. "-" / "_"), else 2.2. if at start of normally lower-cased Identifier or not 1st word, "id", else 2.3. "Id".

    @HotLicks: In all .NET doc code samples I've seen, MS does camel case Local / Private Variables / Methods, else and title case every word.

    – Tom Oct 17 '18 at 22:27
  • ^Corrections:
    1. "identity document" (not "identifier document").

    2. "Re. IT Identifiers: For English meaning #:

    1:

    1.1. "id" (if at start of normally camel-cased Identifier, i..e. Local / Private Variables / Methods), else 1.2. "Id".

    2:

    2.1. "ID" if in Identifiers where words / acronyms are typically separated by a space / punctuation (i.e. "-" / "_"), else 2.2. if at start of normally camel-cased Identifier, "id", else 2.3. "Id"."

    – Tom Oct 17 '18 at 22:37
  • 1
    I think a collision with the rare term "id" is a rather unlikely reason it's ended up this way - as others have pointed out, English is full of homophones, and I don't think there's ever been a risk of someone thinking they were being asked for documentation of their instinctual desires rather than their identity. – IMSoP Jan 29 '21 at 12:35
  • “The de facto standard nowadays seems to be CamelCase”: no. Although most languages with a C-like syntax favor camel case, some widely used languages, such as SQL or bash, do not favor camel case. – Philippe-André Lorin Jan 30 '22 at 08:42
  • The de facto standard, even in 2017, is not "camel case", @Flater. It appears to me that you speak from a position entrenched in proprietary systems and marketing. Out in the real world "snake case" and "kebab case" are most common, depending to some extent on context. – NeilG Mar 21 '24 at 04:09
  • @NeilG: The quote you're referring to is not mine, it's shipr's (i.e. the author of the answer) - which I also referred and responded to in my comment. I'm not sure why you're addressing me to provide a correction to that quote. I also don't appreciate your negative musings on what my position must be. Thirdly, I think you missed the point of my comment, which points out that casing tends to be language-specific. I used the example of C#, where kebab case isn't even accepted by the compiler in the first place. – Flater Mar 21 '24 at 04:52
  • Ah, yes, I see I've mixed the source there, @Flater, thanks for correcting me. It seems we stand more together than apart and my comment is better directed at the author of the answer, who seems to be entrenched in proprietary systems and marketing. – NeilG Mar 21 '24 at 06:41
12

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.

BobbyJ
  • 129
  • 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
  • 1
    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
  • 1
    Although "ID" certainly can stand for "Identity Document", it is not correct to say that it always does so: in "GUID", the "ID" stands simply for "identifier". It may be that the "Identity Document" usage is the original, and other uses came from there, but I've not yet seen a reference proving that. – IMSoP Jan 29 '21 at 13:20
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.

calben
  • 131
  • 3
    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
  • After trying many programming styles over the years, I finally settled on strict camel-case with making even abbreviations lower case (as in siteUrl). The reason is that I really like sticking to whatever the rules are for the first letter of an identifier being capitalized, and this makes it easier. For example, if I always use upper case abbreviations, but the style I'm following asks for lower case on the initial letter of method names, which wins? instance.URLHandler() or instance.urlHandler()? The former doesn't look as much like a method name anymore, while the latter does. – devguydavid Jun 21 '14 at 20:20
  • 1
    There are many different programming ecosystems, they can have very different standards. In some languages the default is camelCase or CamelCase, in some snake_case, in some kebab-case. In the last two, ID will almost always be lower case. In programming you should follow the language conventions over grammar.

    If you want a clear specific example, in HTML IDs are explicitly lower case: http://www.w3.org/TR/html401/struct/global.html#h-7.5.2

    – Korny Feb 24 '15 at 11:40
  • 2
    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 04:02
  • @RegDwigнt: I would use id for local variables. Capitalization changes based on what kind of variable you're using, at least for all languages I'm familiar with. 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. (These are of course nothing more than conventions, not strict rules) – Flater Oct 13 '17 at 09:35
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.

Ellis
  • 101
  • I'd say "ID" is an initialism for "Identity Document". It's not an acronym, no, but neither is SQL in my book. NASA and ASCII are acronyms though, as far as I am concerned. If the word being abbreviated is "identifier", I'd use lower case "id" as a starting point, then let the capitalization convention of the language and project take second effect. – Victor Nov 04 '19 at 12:47
  • 2
    @victor, ID is more far more commonly an abbreviation of "identifier" (or "identification"), not Identity Document. I've worked in several industries and have not encountered the latter. It's likely scoped to legal fields, etc. – isherwood Jan 06 '20 at 15:41
  • @isherwood but your use of capitalized "ID" implies it's an initialism. As far as I'm concerned, abbreviations aren't capitalized. So "ID" is different from "id." or "id". – Victor Jan 06 '20 at 16:12
  • It's not my use, as most of the answers on this page indicate. – isherwood Jan 06 '20 at 16:12
  • 2
    @Victor you seem to rely on the notion that an initialism must be formed from the initials of multiple words, which is not the case. While that is where the word "initialism" comes from, it is not a hard and fast requirement. Initialisms are abbreviations that are pronounced one letter at a time. For example, ECG is an initialism, even though "electrocardiogram" is one word. Similarly, ID is an initialism and can correctly be capitalized even if it derives from "identity" or "identifier" – Flater Jan 29 '21 at 13:48
  • @Flater good input. – Victor Jan 29 '21 at 16:23
0

Although it might be logical to treat "id." as a straight-forward abbreviation for "identity" or "identifier", common usage is to both write and pronounce it as the two separate letters "I" and "D".

See for instance Lexico (based on Oxford dictionaries), the Guardian Style Guide (UK), Chambers, Merriam-Webster (note that some of these feature multiple terms spelled with variants of "id", "Id", etc, but all show "identity" abbreviated to "ID").

I can think of a few reasons why this might be, but have been unable to find evidence for any of them:

  • It may have originated as an abbreviation of "Identity Document", and then became applied more generally - for instance, the phrase "show me your ID" may well be referring to a document, while "make a positive ID" certainly does not, but may be a later usage.
  • The word "id" does have at least one established meaning, although one not used all that commonly outside philosophy, so it's influence is likely to have been small.
  • The first sound in "identity" is the long vowel used when saying the letter "I", not the short vowel which would naturally be read from the spelling "id". A single syllable pronunciation with a long vowel would probably be written "ide.", and would be the same as the very common word "I'd" (abbreviating "I had").

Whatever the reason, "ID" is the common spelling, and in that sense "correct".

As ever, there are exceptions to the rule:

  • When combined into a longer abbreviation that is pronounceable, that abbreviation might come to be spelled as such in some style guides, e.g. you might decide to accept "Guid" (pronounced "goo-id") for "GUID".
  • In some contexts, such as the "camelCase" names often used in programming, it might be considered inconvenient or ugly to have multiple capital letters in a row, e.g. you might decide to use "userId" rather than "userID".
IMSoP
  • 275
  • @Flater I have now added two references for the spelling itself, which is more than any of the other answers on this page. I haven't been able to find any references to the etymology behind that spelling, which is why I included multiple possibilities. – IMSoP Jan 29 '21 at 14:12
0

It all depends on context.

ID is the abbreviated initialism of "Identification Document", but this abbreviation is similar to the abbreviation of the single word Identifier, which is "Id".

If you are referring to a student ID or a driver's license number as their ID number, then use ID since the letters should all be capitalized to indicate to the reader that it stands for multiple words.

If you are a programmer and you are referring to the row number of a record in a table, then you are referring to a Unique identity or Unique identifier, both of which can be referred to an Id. Because the letters are only representing a single word the "d" should never be capitalized.

As answered before, do not use id, as that is a psychological term. (id, ego, super-ego)

  • 1
    Please recognise that ELU practice is to go with the default definitions of respected dictionaries, which reserve 'acronym' for cases where abbreviations are not 'spelled out'. NASA yes, but BBC, an initialism. – Edwin Ashworth Apr 20 '22 at 16:50
  • 1
    You are absolutely correct. FBI, CIA, DEA, DOT and ID are all initialisms not acronyms. Thank you for the constructive feedback. – Tom Graham May 17 '22 at 17:28