Introduced
One
1, why should have code specification
A, 80% of the value of software life is to maintain
b, almost no software throughout the use of the original author maintenance
C, code management to increase the readability of the package, so that programmers better and more complete understanding of the software
D, the original code into a product, the need for uniform packaging
Two
1. Initial comment includes class name, version information, time, copyright
2. Avoid using "*" when guiding the package
3, the length of the line of code to avoid more than 80 characters, can be in the comma, operator,
4. Naming specification
A, component: Contains the area name, department name, project name, machine name or registered name
For example Com.sum.eng com.apple.quicktime.v2
B, Class: Class name is a noun, all spell, the first letter capitalized
such as Class Imagesprite
C, interface name: should be the same name as uppercase
D, program: verb in a mixed word start Word lowercase, each inner word first letter uppercase
For example, run (); Funfirst ();
E, variable names should be short meaning, with n,i,j,m and so on to represent integers,
F, constant: all caps, underline
5, if you try to improve the speed, do not use the inclusion of the allocation, because this is the work of the compiler
For example d= (a=b+c) +r
6, try to make the structure of your program to achieve a commensurate purpose. For example:
If (booleanexpression) {
return true;
}
Instead of directly return booleanexpression;
Java Code Specification