Java Development Programming Specification

Source: Internet
Author: User
Tags final int size lowercase naming convention

Naming conventions

The purpose of defining this specification is to make all documents in the project appear to be written by one person, to increase readability, and to reduce the loss caused by substitutions in the project team. (These specifications are not necessarily strictly adhered to, but make sure that the program has good readability)

The name of the Package

Package's name should all be made up of a lowercase word.

Name of Class

Class must have a name that starts with a capital letter and other words are lowercase

Name of Class variable

The name of the variable must begin with a lowercase letter. The following words begin with a capital letter.

Name of Static Final variable

The Static Final variable's name should all be capitalized, and the full meaning is indicated.

Name of the parameter

The name of the parameter must be the same as the variable's naming convention.

Name of array

The array should always be named in the following way:

byte[] buffer;

Instead of:

BYTE buffer[];

Parameter of the method

Use the name of a meaningful parameter, if possible, with the same names as the field you want to assign a value to:

SetCounter(int size){
this.size = size;
}

Java file Style

All Java (*.java) files must conform to the following style rules

Copyright information

Copyright information must begin at the beginning of the Java file, such as:

/**
* Copyright ® 2000 Shanghai XXX Co. Ltd.
* All right reserved.
*/

Other information that does not need to appear in Javadoc can also be included here.

Package/imports

Package The standard package names in import are preceded by the local package name before the import line, and are sorted alphabetically. If the import row contains a different subdirectory in the same package, it should be treated with *.

Package hotlava.net.stats;

import java.io.*;
import java.util.Observable;
import hotlava.util.Application;

Here java.io.* are used to replace InputStream and OutputStream.

Related Article

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.