1. The meaning of the normative existence:
A good coding specification can reduce the maintenance cost of a software as much as possible, and there is hardly any software that is maintained by the original developer throughout its life cycle;
Good coding standards can improve the readability of the software, allowing developers to quickly and thoroughly understand the new code, good coding standards to maximize the team development of cooperation efficiency;
Long-term normative code can also allow developers to develop good coding habits, and even exercise more rigorous thinking;
2. Naming conventions:
Try to use the full English descriptor
Adoption of terminology applicable to related fields
Make names readable by mixed case
Use abbreviations sparingly, but if used, must conform to the unified definition of the entire project
Avoid using long names (less than 15 letters for normal selection)
Avoid using a similar name, or just a different name for the case
Avoid using underscores (except static constants, etc.)
All Pojo classes correspond to database table names
All DAO interface classes inherit from Basedao, begin with I, end with Pojo class name +dao
All Daoimpl implementation classes end with Pojo class name +daoimpl
All business interface classes begin with I and end with business name +service
All business Implementation class: Business name +service;
3. Identifier type description:
Package Name:
The full English descriptor is made up of a lowercase word
Classes (Class) are named:
The class name should be a noun, in a mixed case, capitalized by the first letter of each word. Try to ensure that the class name is concise and rich in description. Use full words to avoid abbreviations (unless there is a unified abbreviation specification in the project or the abbreviation is used more widely
Name of the interface (Interface):
Similar to the naming conventions of Class. On the basis of satisfying the CLASSD naming rules, the first letter "I" is guaranteed, which is easy to distinguish from normal class.
Enumeration (enum) naming
Naming of exceptions (Exception)
Name of method
In the service, the Operation database update, write, delete, the method name with update, save, edit, add, Move, delet, remove, to ensure that the spring transaction is valid, the data query takes list, get, find the beginning;
The general approach follows:
The method name is a verb, in mixed case, the first letter in lowercase, followed by the first letter of the word capital. The method name describes the action behavior of the method as much as possible. A method that returns a Boolean value typically begins with "is" or "has" for example: The return type is a Boolean value: Starts with "is" or "has"
Get a data: get+ Data Description noun complex number + data type;
Get all data: get+all+ Data Description noun complex number + data type;
Get/Query a data by XXX: get/query+ Data Description noun complex number + data type +by+ condition;
Add a data: save/add+ Data description noun ()
Update a data: save/update+ data description noun;
Delete a data: delete/remove+ data description noun;
Name of the parameter (Param):
The first letter is lowercase, followed by the first letter of the word. The parameter number name does not allow an underscore or dollar sign to start, although this is syntactically permissible. Parameter names should be short and descriptive.
Name of the constant field (Constants):
Static constants fields (static final) are all uppercase letters, and the words are separated by underscores;