java规范(Java specification)
java规范(Java specification)
Hundred skills summary share: Java programming specifications of the experience
In August 23, 2010 by the luanjia Java programming. Listen to the message? Zi Liu said the specification, "every part of this standard has Taobao developers a miserable experience, this is a tragic history of developers -- Zi Liu (100 technical university). In view of the test department is also to write Ruby scripts and WebX test, in order to avoid our testers developers repeat mistakes, I put some common programming specification can be made a summary, I hope to help some of you.
1. write detailed notes at the branch and complex logic of the program
A) code specific processing (such as special conventions, similar strings, combinations or splits by a certain rule, returns different types of objects with List or Map, objects returned in transactions)
B) modified in some logical, complex, or important code, with the author, time, and annotation
Example:
/ * *
* find the main path according to category ID and represent a two dimensional array in the form of:
* [root class,.ID, Root Category. Name] [category X.ID, category X. name],... [category.ID, this category. Name].
*
* @param catPath
*
* @return String[][]
*
* /
String[][] getCategoryStringByPath (String catPath);
Experience: product line business has been relatively complex, and the business logic changes frequently, so the test summary the method with the business and the business logic, it has been deleted in the business logic changes or the business, can be found directly modify or delete this part of the test code, not a need or out of date has been retained in the program code, the code is more and more, more and more readable.
In the annotation of the 2. method, the specification of the parameter and the description of the return value should be written in detail
/ * *
* check whether the string is null
or empty string , '
'.
*
* StringUtil.isEmpty (null) = true
*