This post originated from an RSS feed registered with .NET Buzz
by Darrell Norton.
Original Post: Capitalization: Should you use ID or Id
Feed Title: Darrell Norton's Blog
Feed URL: /error.htm?aspxerrorpath=/blogs/darrell.norton/Rss.aspx
Feed Description: Agile Software Development: Scrum, XP, et al with .NET
Ander Stevenson has a post asking whether to ID or to Id. FxCop treats the ID as an error of the capitalization guidelines (name acronyms of three or more characters are Pascal-cased, and ID is not considered an acronym, it’s an abbreviation).
First off, realize that FxCop are rules that were originally developed for component developers extending the .NET Framework. Go look at this page here and read the title. Right, design guidelines for class library developers (my emphasis added!). That’s why the rules include all sorts of globalization, standard usage and naming guidelines, COM interop, etc. Microsoft wants people that sell products that extend the Framework to play by the same rules as they did, or tried to do, anyway.
That being said, Microsoft made the egregious error (I’m being sarcastic here, see Brad Abrams for a discussion on why the choice was made) that 2-letter abbreviations, such as IO for input-output, should both be capitalized. FxCop has the IO override hard-coded in the program, but ID is not. You can exclude the error on a per-occurrence basis, but who wants to do that?
So the choice is up to you. If you are designing a non-public API (that is, an API that will not be exposed via a service or to external consumers), I don’t think that this rule matters if you really like your ID. But if someone external to your team will see it, then follow the naming guideline.
This Blog Hosted On: http://www.DotNetJunkies.com/