My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for
CodingGuidelines  
Coding Practices and Guidelines
Updated Mar 9, 2010 by jayde...@gmail.com

General Guidelines


Term Description
Pascal case The first letter in the identifier and the first letter of each subsequent concatenated word are capitalized. You can use Pascal case for identifiers of three or more characters.
Example: BackColor
Camel case The first letter of an identifier is lowercase and the first letter of each subsequent concatenated word is capitalized.
Example: backColor
Hungarian notation Hungarian notation is a naming convention in computer programming, in which the name of a variable indicates its type or intended use. In other words, it is the practice of including a prefix in identifiers to encode some metadata about the parameter, such as the data type of the identifier.
Example: strBackColor (backColor is string type)

Naming

  • Use abbreviations only when needed.
  • Do not use underscores. Except in constants.
  • Do not use acronyms that are not generally accepted in the computing field. Where appropriate, use well-known acronyms to replace lengthy phrase names.
    E.g. use “OnButtonClick” instead of “OnBtnClick”.
  • Do not use namings that differ by only casing.
    E.g. namespace ee.cummings; namespace Ee.Cummings;
  • Do not use Hungarian notation for naming properties and fields
    E.g. string strBackColor

Other Pointers

  • If you need to hard code a value/string, declare them as constants.
  • Method name should explain what it does. Do not use misleading names.
  • Write comments wherever required. Good readable code will require very little comments. If all variables and method names are meaningful, that would already make the code fairly readable.

Class


Naming

  • Use Pascal casing.
    E.g. public class StudentRegistration

Interface


Naming

  • Use Pascal casing.
  • Prefix with I in front of naming.
    E.g. public interface IRegistration

Methods


Naming

  • Use Pascal casing.
    E.g. SaveFolderPaths()

Parameter


Naming

  • Use Camel casing.
    E.g. string studentName


Sign in to add a comment
Powered by Google Project Hosting