This topic is not as toxic than the tabs-vs-spaces or 2 vs 4 indents discussion, but it’s still something every coder I have met have an opinion about, no matter the programming language:
Which is correct:
- OrderId
- OrderID
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“.
ID wins
WIKIPEDIA
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.
ID wins
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.
Id wins
COLLINS DICTIONARY
The Collins dictionary also states that ID is a noun and means identity or identification, while Id is short for Idaho.
ID wins
CAMEL CASING
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.
ID wins
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.
CONCLUSION
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:
- OrderIdentity
But tell me what do you think? OrderID or OrderId?
MORE TO READ: