pascalCase and camelCase Naming System


Introduction

pascalCase and camelCase are naming recommendations and it is good practice to follow them always. Everyone is a programmer but the ones who follow these recommendations are good programmers. pascalCase and camelCase naming conventions are purely based on accessibility of class members. In other words, how to specify a method or field name if it has public accessibility or how to specify it if it has private accessibility.

 

Public Naming Recommendation

Identifiers that are public should start with a capital letter. Look at the example given below; the Addition field and Add methods given below start with capital 'A' (not small 'a') because it's public.

This system is known as the PascalCase naming scheme because it was first used in the Pascal language.

class Calc
{
   
public int Addition;

    public double Add()
   
{
       
//statements
   
}
}

Private Naming Recommendation

Identifiers that are private should start with a small letter. Look at the example given below; the addition field and add methods given below start with small 'a' (not capital 'A') because they are private. This system is known as the camelCase naming scheme.

class Calc
{
   
private int addition;

    private double add()
   
{
       
//statements
   
}
}

Remember this recommendation: class names should start with a capital letter. Never declare two public class members whose names differ only in case. If you do so then, developers who are using other languages that are not case sensitive, such as Microsoft Visual Basic, can't use our class.

HAVE A HAPPY CODING!!


Similar Articles