Naming conventions for all the languages

For standardizing the process of coding conventions across Organization, We have come up with some ideas which will help us to code in same fashion and ofcourse it will be updated based upon the best opinion received about a particular convention.

Word Choice

  • Choose easily readable identifier names.
    For example, a property named HorizontalAlignment is more English-readable than AlignmentHorizontal and CanScrollHorizontally is better than ScrollableX.
  • Don’t use underscores, hyphens, or any other nonalphanumeric characters.
  • Don’t use Hungarian notation (Specifying the type with variable name).
    For example : strUsername, dtStudents, btnSubmit are not allowed where as Username, Students, Submit are perfectly acceptable

Using Abbreviations and Acronyms

  • Don’t use abbreviations or contractions as part of identifier names.
    For example, use GetWindow rather than GetWin.
  • Acronyms should be discouraged, use only wherever they are unavoidable but acceptable only in case of module.
    For example : stName is wrong whereas studentName is right but In case of a module let’s say the module name is PaymentPlanConfiguration then for naming the class use of PCRUsers is allowed

Using singulars and plurals

  • Wherever the name represents a single entity then it should be named singular.
    [code language=”csharp”]
    Student student = new Student(); //Acceptable
    Student singleStudent = new Student(); //Not Acceptable
    Student objStudent = new Student(); //Not Acceptable
  • Wherever the name represents a collection which can be an array or list then it should be named plural.
    [code language=”csharp”]
    Student[] students = new Student[5]; //Acceptable
    Student[] fiveStudents = new Student[5]; //Not Acceptable
    Student[] multipleStudents = new Student[5]; //Not Acceptable

Microsoft’s General Naming Conventions

Leave a Reply

Your email address will not be published. Required fields are marked *