ASP.NET naming conventions…yuck
Typing the phrase “naming conventions” makes me feel ill. They have always been someone of an objective topic and a topic that has ALWAYS lead to intense debate. Well, I hope that my little foray into code analysis has lead me to stumble upon a clear concise description for ASP.NET naming conventions.
I ran the new release of FxCop against one of my projects today and came across a few, 1504 to be exact, messages about incorrect naming conventions. Ha!, Like there is a correct way to format your code…wait…what Microsoft thru the error…hmm…maybe someone should check the error description.
Update: The error log is from a clients project, I do not have control over naming standards with this particular client.
Type, namespace, and member identifiers are Pascal-cased.
Parameter identifiers are camel-cased.
Two letter acronyms within these identifiers should be upper-cased, for example, use System.IO instead of System.Io.
Acronyms of three or more letters should be Pascal-cased, for example, use System.Xml instead of System.XML.
The pascal-casing convention capitalizes the first letter of each word, as in BackColor.
The camel-casing convention formats the first letter of the first word in lowercase and capitalizes the first letter of all subsequent words, as in backgroundColor.
Although it may be common practice for some two letter acronyms to not be fully capitalized, violations of this rule should not be excluded for this reason. For example, ‘DbConnection’, is common but incorrect; use DBConnection.
A violation of this rule might be required for compatibility with existing, non-managed symbol schemes. In general, however, these symbols should not be visible outside the assembly that uses them.
No related posts.
No comments yet.