One, Java file naming specification
1. Package Name
The name must all be in English lowercase letters, prohibit the use of "underline" characters. (in addition to constants, the use of underscore characters is not recommended in Java naming conventions)
Project package naming rules:< domain name reversal >.< team name >.< project name >. Related projects can use the < domain name Reversal >.< team name >.< Parent project name >.< subproject name > naming laws.
2.class/object, Interface
Classes and interfaces using the big hump naming method
Abstract class uses "abstract" as the beginning of a class naming
Exception class naming uses "Exception" as the end of the class naming
The test class uses "test" as the end of the class name
In interface-oriented programming, the naming convention for an interface's implementation class is the:< interface name >+ "Impl". The use of Hungarian nomenclature is prohibited.
Example (correct):
Interface |
Implementation class |
Handsomeprovider |
Handsomeproviderimpl |
Hungarian nomenclature (not recommended):
Interface |
Implementation class |
Ihandsomeprovider |
Handsomeprovider |
3.method/function
Methods are named using the Hump method, generally using verbs or verbs + noun combinations.
Set/Get a method of a value named Setv/getv
Returns the length of the method, which is named length
A method for judging a Boolean value, named ISV
Methods that convert an object to a specific type should be named tot
4. Naming of variables
The first letter is lowercase, followed by the first letter of the word, for example: MaxValue.
The variable name should not begin with an underscore or dollar sign, although this is syntactically permissible. Variable names should be short and descriptive. The choice of variable name should be easy to remember, that is, can indicate its use. Try to avoid the variable name of a single character unless it is a one-time temporary variable.
Pojo in the Boolean variable, do not add is (the Boolean fields in the database are all prefixed with is_).
5. Naming conventions for constants/enumeration values
The constant name/enumeration value should both use uppercase letters and underline the words.
Example: Max_value
Second, database naming specification
Table names and field names must be in lowercase letters or numbers, numbers cannot start, and two underscores cannot have only numbers.
The library name is as consistent as the application name.
Table name: The function of the Business name _ table (singular form).
Primary key index: PK_ field name.
Unique index: UK_ field name.
Normal index: IDX_ field name.
Indicates whether the field: is_xxxx unsigned tinyint (1. Indicates yes, 0. Indicates no).
Trigger: Trg_ table name _[Insert | update | delete]
Views: Viw_ Related table name 1_ related table name 2_ ...
The database prohibits the use of stored procedures.
Third, version tool submission information specification
Line 1th: Submit a summary of the changes (less than 25 Chinese characters, or English capital letters start with no period, use imperative).
Line 2nd: Blank line
Line 3rd and beyond: The reason for the change (36 kanji to wrap around, the body explains what and why, not how to do).
Original address: https://www.cnblogs.com/caixueliang/p/7469638.html,https://www.cnblogs.com/niceboat/p/6180625.html
Java Naming conventions