Packages :
lowercase
In
software companies and large projects where the packages might be imported into
other classes,the names
will normally be subdivided. Typically this will start with the company domain
before being split into layers or features:
Eg : package org.company.mycalculator
Classes :
CamelCase ( Each new word begins with capital letter)
Try to use nouns because a class is normally
representing something in the real world
Eg : class MyCustomer
Interfaces
: camelCase :
They tend
to have a name that describes an operation that a class can do
Eg : interface MyCustomer
Note : can
use " I " to distinguish interfces from others.
Eg : interface IMyCustomer
Methods :
MixedCase ( starting with lowercase ,after that eash new word begins with
capital letter )
Use verbs to describe what the mothod
does :
Eg : void myCustomer()
Variables
: mixed case :
The names
should represent what the value of the variable represents:
Eg : String firstName
Only use
short names when the variables are short lived ,Such as in for loops
Eg :
for(int i=0;i<=3;i++){
// we use
" i " only inside of the loop .
}
Constants
: Uppercase :
Eg : static final int AGE ;
No comments:
Post a Comment