Java Naming Conventions Meeting Minutes
Meeting Info ¶
| Date | 2022-07-07 |
|---|---|
| Topic | Discussion on Java Naming Conventions |
| Attendee | Calvin Yan, Rocky Chi, Daniel Zhou, Ted Zhao, Jackson Liu, Albert Wang |
| Note Taker | Jackson Liu |
| Timer | Rocky Chi |
| Duration | 60 minutes |
Meeting Agenda ¶
- Discussion on java naming conventions (30 mins)
- Present how to write markdown file (20 mins)
Meeting Minutes ¶
- discuss the rules of java naming
- separate two rules to redefine the priority of each one
- Results of discussion:
| Rule Name | Result | Comments |
|---|---|---|
| 1. Names should not start or end with an underline or a dollar sign. | Mandatory | |
| 2. Using Chinese, Pinyin, or Pinyin-English mixed spelling in naming is strictly prohibited. Accurate English spelling and grammar will make the code readable, understandable, and maintainable. | Mandatory | |
| 3. Class names should be nouns in UpperCamelCase except domain models: DO, BO, DTO, VO, etc. | Mandatory | |
| 4. Method names, parameter names, member variable names, and local variable names should be written in lowerCamelCase. | Mandatory | |
| 5. Constant variable names should be written in upper characters separated by underscores. These names should be semantically complete and clear. | Mandatory | |
6. Abstract class names must start with Abstract or Base. Exception class names must end with Exception. Test case names shall start with the class names to be tested and end with Test. | Mandatory | |
7. Brackets are a part of an Array type. The definition could be: String[] args; | Mandatory | |
| 8. Do not add 'is' as prefix while defining Boolean variable, since it may cause a serialization exception in some Java frameworks. | Mandatory | |
9. A package should be named in lowercase characters. There should be only one English word after each dot. Package names are always in singular format while class names can be in plural format if necessary. | Mandatory | |
| 10. Uncommon abbreviations should be avoided for the sake of legibility. | Mandatory | Some abbreviations could be used such as MCT, MAV, and GSS, etc. |
| 11. The pattern name is recommended to be included in the class name if any design pattern is used. | Recommended | |
12. Do not add any modifier, including public, to methods in interface classes for coding simplicity. Please add valid Javadoc comments for methods. Do not define any variables in the interface except for the common constants of the application. | Recommended | |
13. All Service and DAO classes must be interfaces based on SOA principle. Implementation class names should end with Impl. | Mandatory | There are two main rules for interface and corresponding implementation class naming: |
| 14. If the interface name is to indicate the ability of the interface, then its name should be an adjective. | Recommended | There are two main rules for interface and corresponding implementation class naming: |
15.An Enumeration class name should end with Enum . Its members should be spelled out in upper case words, separated by underlines. | Recommended | |
| 16. Naming conventions for Service/DAO layer methods 1) Use get as name prefix for a method to get a single object.2) Use list as name prefix for a method to get multiple objects.3) Use count as name prefix for a statistical method.4) Use insert or save (recommended) as name prefix for a method to save data.5) Use delete or remove (recommended) as name prefix for a method to remove data. 6) Use updat as name prefix for a method to update data. | Mandatory | Naming conventions for different package layers: |
| 17. Naming conventions for Domain models 1) Data Object: *DO , where * is the table name.2) Data Transfer Object: *DTO , where * is a domain-related name.3) Value Object: VO, where * is a website name in most cases. 4) POJO generally point to DO/DTO/BO/VO but cannot be used in naming as POJO. | Recommended | Naming conventions for different package layers: |
References ¶
https://alibaba.github.io/Alibaba-Java-Coding-Guidelines/#naming-conventions
