ID or Id?

Looks like there are two groups of developers. One writing ID and one writing Id. I'm in the first one, and I'm even not 100% sure why (except because my feelings are saying me, it's "more" correct). But it looks like there's no conclusion.

More and more I see the other option being used often (DbContext or HttpApplication to name a few), especially if you take into account properties like URL and so on. It even looks this is more common inside .NET Framework, but still, i.e. DBNull or System.Web.UI is an exception. Who knows...

Anyway, I'd like to ask you. What are your habits? Have you find some good pros (or cons) for one or the other? Or articles/papers/... about this naming? Share your thoughts in comments.

Update:
In "Framework Design Guidelines: Conventions, Idioms, and Patterns for Reusable .NET Libraries (2nd Edition)" I've found (link):

Two other terms that are in common usage are in a category by themselves, because they are common slang abbreviations. The two words Ok and Id (and they should be cased as shown) are the exceptions to the guideline that no abbreviations should be used in names.

Solved. On the other hand the DbContext and DBNull is still weird inconsistency.

8 thoughts on “ID or Id?

  1. gius

    I like the ID version too, nevertheless, we use both. ID is used for our own keys (ie., primary key – ID, foreign key – UserID) and Id for keys from external systems (eg., SapId).

  2. gius

    “For example, ID is an abbreviation for identifier. In general, library names should not use abbreviations.”
    And then see the yellow Note box in the first third of the document:
    “The two abbreviations that can be used in identifiers are ID and OK. In Pascal-cased identifiers they should appear as Id, and Ok. If used as the first word in a camel-cased identifier, they should appear as id and ok, respectively.”

    So it seems that Id is the recommended way to go. :-(

  3. cincura.net Post author

    Oh man, that sucks. :) OTOH it doesn’t solve the confusion around DBNull and DbContext or does it?

  4. Robert Haken

    We (at HAVIT) use ID as the only uppercase abbreviation as it is allways used standalone or at the end of the identifier (which does no affect readability ensured by using PascalCase for all other abbrevs)

  5. Andreas

    Always Camelcase:

    1) Constants are Uppercase (ID)
    2) Variable: Id

    3) Look at something like: IDURLOCR (unreadable) better IdUrlOcr

Leave a Reply