ID vs. Id (The naming of things)

I have a longtime habit of naming things like UserID with the i and the d capitalized, but FxCop doesn't seem to like that and keeps recommending Id.

Which do you use and which do you think is correct?



  • Here we use:

    FooID (not FooId)

    FooSql (not FooSQL)

    I believe the published conventions agree camel-case for acronyms of three or more letters and caps for less. So the only possible issue would be if you don't consider ID an acronym *shrug*

  • I have made it a habit of using CamelCase which would indicate that I should be using Id as opposed to ID. I usually reserve UPPERCASE for constants.

    I apply the same standard when naming columns in my database entities as well. For example column name would be CustomerId and not CustomerID.

  • I do not consider Id an acronym but rather an abbreviation <sigh>. Thus the use of Id as opposed to ID. I would gather we could debate this as many before us have, with good arguments on both sides of the house.

  • I'm like you, I used to use ID, but fxCop has drilled the Id into me.

  • I prefer "ID" as it is consistent with the way the framework names "ID" This also makes it consistant with the pronounciation... eye-dee as opposed to rhymes-with-squid.

  • I'm gonna have to vote ID as common usage in our language dictates. I have yet to visit a single bank, store or government building that had a sign stating "Photo Id required". Although it may be incorrect, every printed form of the word (used in the context of identification) that I have ever seen is spelled ID...not Id. But then again, we're programmers...we make our own rules :) In terms of naming fields/variables, I like the < 3 letters all caps, > 2 cammel case rule.

  • I agree with Jim and Mike here. ID has my vote. Eye-Dee. Not 'eyed'...

  • IO : Input Output

    UI : User Interface

    ID : Identification ...?

    I have this feeling that ID was once an acronym for Identifying Document and thus should be ID.

    This corresponds to signs in bars that say everyone must present ID and you don't just say your name.

    Most common usage seems to follow this, but in code it usualy just means Identifier (or even Guid)

    I think I'm gonna stick with ID, it will require a lot less explaining ;)

  • I see all the arguments for a strict adherence to camel casing and cannot argue with the logic. I am retraining myself to use Id instead of ID. Still, I wish it were not so.

    One of the biggest hurdles I faced learning C# after writing VB is its case sensitive nature. Writing code, or an email for that matter, I like to write out acronyms with capital letters. In VB I would write SQLConnection. I am now used to writing things out the way they should be. But as a matter of style I still like my old patterns better.

  • We made a choice at the office that we should use camel case naming thus making "Id" the approriate choice although some will use the "ID" form still. I am a strong believer in "no exceptions" thus I find the Id form better.

  • I always use "Id" in C#/VB.NET/any other OO language. *But* I religiously use "ID" in database schemas.

    Not looking forward to the religious battle I'm going to have with myself when SQL Server 2005 makes it to gold code...

  • Make sure you are consistent... and make sure you are obeying the laws. Therefore, make sure you are always using Id. The rules are there for a reason. Don't let your personal emotions get in the way of doing what's right.

  • I vote for ID. One reason is that the plural looks better. Consider: "One ID, two IDs", versus "One Id, two Ids". "Two Ids" looks like it should be written as "Two Id's", but then it gets confused with a possessive ("enforce the Id's uniqueness") or an is/has abbreviation ("my Id's changed recently").

  • Just came across this one. I should note that Id is also a psychological term coined by Freud. That being the case, ID seems a good way to differentiate the former. The previous poster mentioned "two Ids", which sound more like something that came out from a psychology book than from a program.

  • I think the mistake was that an abbreviation was chosen in the first place! Abbreviations are nasty.

    They should have picked an acronym perhaps, like DI - Data Identifier.

  • I use ID
    Javascript's getElementById gets me every time.

Comments have been disabled for this content.