According to Merriam-Webster, the abbreviation is "ID". If it were a correct abbreviation, it would have to be "Id." with the period. This is absolutely the right answer.
"ID" as a word is correct not because it has only two letters, it's correct because that's the accepted short form of "identification."
'"ID" is a short form for "identity" or "identification": For legal immigrants, a primary ID includes a green card, authorization of employment from the Department of Justice or certificate of naturalization.
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.
Id is an abbreviation, not an acronym, so I case it "Id." UI is an acronym, and acronyms--short ones, anyway--get capitalized: "UI."
Here's a sample of what I do:
id
userId
getUserId
The key is being consistent.
I do what I feel like. In general, your best practice is to err in favor of readability vs. compliance with some abstract standard.
Just be consistent.
I actually prefer "ID". But, as everyone says, consistency is the most important thing.
Steve
Id, as for Identifier. Microsoft's suggested naming conventions indicate that that's the recommended practice and compiling with code analysis will support that. You would use ID if it stood for two words starting respectively with I and D and you're really not supposed to use names starting with lowercase letters but in parameters.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With