This section describes general naming conventions that related to word choice, guidelines on using abbreviations and acronyms, and recommendations on how to avoid using language-specific names and a class structure in our program. Naming convention in different section are as follows:
Word Choice:
1. Do choose easily readable identifiers names.For example, a property named Vertical Alignment is more English readable than Alignment Vertical.
2. Do favor readability over brevity. For example, the property name can ScrollVertically is better than ScrollableY(y- represents of y-axis)
3. Do not use underscores, hyphens or any other non-alphanumeric characters.
4. Avoid use of Hungarian Notation. It creates contradiction as well as ambiguity to the developer.
5. Avoid using identifiers that conflict with keywords of widely used programming language.
6. Do not use abbreviation or contradiction as part of identifiers names.
I. Naming: “The beginning of wisdom is to call things by their proper name.” ― Confucius. “Meaningful” is the keyword in naming.
II. Variables Names: Do not abbreviate variables names and names should be descriptive and meaningful.
III. Namespace: In namespace, names should be meaningful and complete. Do not abbreviate. Using pascal Casing for giving names of the namespace.
For example, Microsoft.Office.Powerpoint.If you want to categories namespace for separation, used plurals naming conventions.For example, stem.Collections;
IV. Classes: Class names should be a noun and again meaningful avoid verbs. Do not prefix (“C”) in class name.
V. Methods: Always use a verb-noun pair, unless the method operates on its containing class, we use a verbs. For parameter naming used Camel Casing (e.g. propertyUse).
VI. Private Member Variables: if you are declaring private member variables in a class then we should adding prefix or suffix to all class level member variables with (underscore) m_ or _m.
VII. Interfaces: Prefix the all interface with ‘I’ that should be reflect capability either a general noun or an –“-able”.
VIII. Custom Attributes: used ‘Attribute’ keyword at the end of naming of custom attribute.
IX. Custom Exception: used ‘Exception’ keyword at the end of naming of custom Exception.
X. Delegate: used ‘Handler’ keyword at the end of naming of event handler and declaration of delegate with suffix ‘delegate’ keyword in naming.
XI. Generics: We don’t use ‘Type’ as a suffix for naming in generics. Using ‘T’ as parameter for the strongly -typed object declaration.
XII. Assembly DLL’s: Do choose names for your assembly dll that suggest large chunks of functionality, such as System.Data or for example,
<Company_Name><Component_Name>.dll
XIII. Enumeration: Do use singular type name for an enumeration unless its value are bit fields. We use ‘enum’ as a suffix for enum type naming.
XIV. Miscellaneous:
1. Avoid putting using statements inside a namespace.
2. Do check spelling in comments
3. Avoid fully qualified names.
4. .All member variables should be declared at the top of class’s. Properties &methods should be separated by one line each.
5. Declare local variable as close as possible to the first time they were used. Etc.
Leave Comment