pascalCase and camelCase Naming System
Introduction
pascalCase
and camelCase are naming recommendations and it is good practice to follow this
always. Everyone is programmer but the one who follow these systems is good
programmer. pascalCase and camelCase naming conventions is purely based on
accessibility of class members. In other word, how to write method or field
name if he has public accessibility or how to write if he has private
accessibility.
Public Naming Recommendation
Identifiers
that are public should start with a capital letter. Look at example given below,
Addition field and Add methods given below starts 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 example given below,
addition field and add methods given below starts with small 'a' (not capital 'A')
because it is 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 is using other languages that are not case sensitive, such as
Microsoft Visual Basic, will can't use our class.
Comments
Post a Comment