Which is correct:
Lets solve this ancient mystery like any programming problem is solved: We Google it.
THE MERRIAM-WEBSTER DICTIONARY
According to Merriam-Webster, ID is short for identification, spelled with 2 capital letters. This matches the intention of OrderID as “Order identification“.
In Wikipedia we can learn that Id is part of the Freudian psyche structural model, and is used to describe the Id, ego and super-ego. When searching for id however, the 2 capital letters “ID” leads to an article on Identity Document and Identifier, the intended description of the ID in OrderID.
MICROSOFT .NET CAPITALIZATION CONVENTIONS
Microsoft does not agree with Merriam-Webster, and clearly states that Id should be written with one capital letter, as OrderId.
The Collins dictionary also states that ID is a noun and means identity or identification, while Id is short for Idaho.
You would think that camel casing would vote for Id, but no, when you have two letters, both should be upper case. When you have three, only the first one should be upper case.
GOOGLE DEVELOPER DOCUMENTATION STYLE GUIDE
Google is on the ID team, unless its in string literals and enums:
“Not Id or id, except in string literals or enums. In some contexts, best to spell out as identifier or identification.”
ID wins, but since Id is allowed in some contexts, I will say this is a draw.
Well, ID is the winner over Id with a 5-2 victory. This does not make you a bad programmer should you choose to use Id instead of ID. As long as you do it consistently. And if in doubt, you could always waste a few more bytes and spell out the entire ID:
But tell me what do you think? OrderID or OrderId?
MORE TO READ:
- Merriam-Webster ID
- Wikipedia Id
- Wikipedia ID search
- Camel Casing
- Google Developer Documentation Style Guide