First, the naming style
1. The name in the code cannot begin and end with the underscore and dollar sign.
2, the code is strictly forbidden to use Pinyin and English mixed way, more can not use Chinese.
3, the class name must use the Hump form (uppercamelcase), the exception: BO, do, DTO.
4, method name, parameter name, member variable name, local variable names unified use Lowercamelcase.
5, the constant name all uppercase, each word with _ separate, for example: Max_stock_count.
6. Abstract class naming must begin with abstract or base, the exception class is named with exception end, and the test class ends with test.
7, the brackets are part of the array type, string[] args.
8, Pojo in the Boolean type of variables are not added is, otherwise it will cause serialization errors.
9, the package name is used in lowercase, the point between the use of natural semantic words, not allowed to use the plural form, the class name can use the plural form.
10, the elimination of all non-standard shorthand, to avoid the hope that the text does not know righteousness.
11, if the use of design patterns, in the class name to reflect the specific design patterns, such as: Orderfactory/loginproxy
12, enumeration class name to end with an enum, enumeration uniform use uppercase each word underlined separately.
13. The naming conventions of each layer:
A) Service, DAO layer method naming:
1) Get a single object with get as prefix;
2) Get multiple objects with list as prefix;
3) Delete the prefix with remove;
4) Save with Save as prefix;
5) Updates are prefixed with update;
B) domain model naming:
1) Data object: XXXDO,XXX is the data table name;
2) Data Transfer object: XXXDTO,XXX is the business domain related name;
3) Display object; Xxxvo,xxx is the name of the Web page;
Second, constant definition
1, do not allow any magic value, directly appear in the code, such as: "Jrxj" +xxx.
2. Long must end with L when assigning an initial value.
3, do not use a constant class to maintain all constants, according to the function of the distinction, such as the cache related to the use of cacheconstant, system-related use of configconstant.
4, constant reuse level: Across application constants, in-app shared constants, in-sub-engineering shared constants, in-package shared constants, in-Class shared constants,
Shared constants across apps: stored in two-party libraries, usually client jar;
In-app shared constants: stored in a library, usually under the constant directory of the modules;
Sub-project shared constants: Under the constant directory of the sub-project;
In-Package shared constants: The current package under the separate constant directory;
In-Class shared constants: Directly inside the class private static final ...
5. If a variable changes within a certain range and has a certain deferred property, the enumeration is used.
Java Programming Protocol