Java Code Specification

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.