Genaral Principles一般约定
1.Adhere to the style of the original.
保持最初的样式。
2.Adhere to the Principle of Least Astonishment.
遵守最小惊奇原则。
3.Do it right the first time.
第一次就应当做好。
4.Document any deviations.
对于任何背离都应当文档注释。
Formatting Conventions格式约定
5.Indent nested code.
约束嵌套代码。
6.Break up long lines.
拆分长行。
7.Include white space.
包含空格。
8.Do not use "hard" tabs.
不要使用tab键。
Naming Conventions命名约定
9.Use meaningful names.
使用有意义的名称。
10.Use familiar names.
使用熟悉的名称。
11.Question excessively long names.
不要使用过长的名称。
12.Join the vowel generation.
加入元音字母。
13.Capitalize only the first letter in acronyms.
只对简称的第一个字母大写。
14.Do not use names that differ only in case.
不要使用只依赖于大小写来区分的名称。
PackageNames<wbr><wbr>包命名</wbr></wbr>
<wbr><wbr>15.Use the reversed, lowercaseform of your organization's Internet domain name as the rootqualifier for your package names.<br style="line-height:22px"><wbr><wbr>采用你组织的Internet域名的反转、<wbr style="line-height:22px">小写形式作为包名称的根限定词。<br style="line-height:22px"><br style="line-height:22px"><wbr><wbr>16.Use a single, lowercase wordas the root name of each package.<br style="line-height:22px"><wbr><wbr>使用一个唯一的小写单词作为每个包的根名称。<br style="line-height:22px"><br style="line-height:22px"><wbr><wbr>17.Use the same name for a newversion of a package, but only if that new version is still binarycompatible with the previous versin, otherwise, use a newname.<br style="line-height:22px"><wbr><wbr>只有当包的新版本仍然与旧版本兼容时,<wbr style="line-height:22px">对于包的新版本使用相同的名称,否则使用新名称。<br style="line-height:22px"><wbr><wbr><br style="line-height:22px"><strong style="line-height:22px">Type Names类型命名</strong><br style="line-height:22px"><br style="line-height:22px"><wbr><wbr>18.Capitalize the first letterof each word that appears in a class or interface name.<br style="line-height:22px"><wbr><wbr>对于类和接口名称只对每个单词的第一个字母大写。<br style="line-height:22px"><wbr><wbr><br style="line-height:22px"><strong style="line-height:22px"><wbr><wbr>ClassNames<wbr><wbr>类命名</wbr></wbr></wbr></wbr></strong><br style="line-height:22px"><br style="line-height:22px"><wbr><wbr> 19.Use nouns when namingclasses.<br style="line-height:22px"><wbr><wbr> 使用名词来命名类。<br style="line-height:22px"><wbr><wbr><wbr><br style="line-height:22px"><wbr><wbr> 20.Pluralize the names ofclasses that group related attributes, static services, orconstants.<br style="line-height:22px"><wbr><wbr>对于成组的相关属性、静态服务和常量,类名称采用复数形式。<br style="line-height:22px"><wbr><wbr><br style="line-height:22px"><wbr><wbr><strong style="line-height:22px">Interface Names 接口命名</strong><br style="line-height:22px"><br style="line-height:22px"><wbr><wbr> 21.Use nouns or adjectiveswhen naming interfaces.<br style="line-height:22px"><wbr><wbr> 使用名词或形容词来命名接口。<br style="line-height:22px"><br style="line-height:22px"><strong style="line-height:22px">MethodNames<wbr><wbr>方法命名</wbr></wbr></strong><br style="line-height:22px"><br style="line-height:22px"><wbr><wbr>22.Use lowercase for the firstword and capitalize only the first letter of each subsequent wordthat appears in a method name.]<br style="line-height:22px"><wbr><wbr>方法名称中第一个单词小写,<wbr style="line-height:22px">后续的每一个单词仅第一个字母大写。<br style="line-height:22px"><br style="line-height:22px"><wbr><wbr>23.Use verbs when namingmethods.<br style="line-height:22px"><wbr><wbr>使用动词来命名方法。<br style="line-height:22px"><br style="line-height:22px"><wbr><wbr>24.Follow the JavaBeansconventions for naming property accessor methods.<br style="line-height:22px"><wbr><wbr>命名属性访问方法遵守JavaBeans约定。<br style="line-height:22px"><br style="line-height:22px"><strong style="line-height:22px">Variable Names变量命名<wbr><wbr></wbr></wbr></strong><br style="line-height:22px"><br style="line-height:22px"><wbr><wbr>25.Use lowercase for the firstword and capitalize only the first letter of each subsequent wordthat appears in a variable name.<br style="line-height:22px"><wbr><wbr>变量名称中第一个单词小写,<wbr style="line-height:22px">后续的每一个单词仅第一个字母大写。<br style="line-height:22px"><br style="line-height:22px"><wbr><wbr>26.Use nouns to namefields.<br style="line-height:22px"><wbr><wbr>使用名词来命名成员变量。<br style="line-height:22px"><br style="line-height:22px"><wbr><wbr>27.Pluralize the names ofcollection reference.<br style="line-height:22px"><wbr><wbr>对于集合引用的名称采用复数形式。<br style="line-height:22px"><wbr><wbr><br style="line-height:22px"><wbr><wbr>28.Establish and use a set ofstandard names for trivial "throwaway" variables.<br style="line-height:22px"><wbr><wbr>对于通常的临时变量,建立并使用一套标准名称。<br style="line-height:22px"><wbr><wbr><br style="line-height:22px"><strong style="line-height:22px"><wbr><wbr>FieldNames 成员命名</wbr></wbr></strong><br style="line-height:22px"><br style="line-height:22px"><wbr><wbr> 29.Qualify field variableswith "this" to distinguish them from local variables.<br style="line-height:22px"><wbr><wbr>使用"this"限定成员变量以同局部变量区分。<br style="line-height:22px"><wbr><wbr><br style="line-height:22px"><strong style="line-height:22px">Parameter Names参数命名</strong><br style="line-height:22px"><br style="line-height:22px"><wbr><wbr> 30.When a constructor or "set"method assigns a parameter to a field, give that parameter the samename as the field.<br style="line-height:22px"><wbr><wbr>当构造函数或者"set"方法向成员分配参数时,<wbr style="line-height:22px">参数的命名应和成员相同。<br style="line-height:22px"><br style="line-height:22px"><strong style="line-height:22px">Constant Names常量命名</strong><br style="line-height:22px"><br style="line-height:22px"><wbr><wbr>31.Use uppercase letters foreach word and separate each pair of words with an underscore whennaming constants.<br style="line-height:22px"><wbr><wbr>当命名常量时,每个单词均大写,单词之间以下划线区分。<br style="line-height:22px"><br style="line-height:22px"><strong style="line-height:22px">Documentation Conventions文档约定</strong><br style="line-height:22px"><br style="line-height:22px"> 32.Write documentation for those who must use your code and thosemust maintain it.<br style="line-height:22px"> 为那些使用你代码和维护它的人写文档。<br style="line-height:22px"><br style="line-height:22px"> 33.Keep comments and code in sync.<br style="line-height:22px"> 保持注释与代码同步。<br style="line-height:22px"><br style="line-height:22px"> 34.Use the active voice and omit needless words.<br style="line-height:22px"> 使用积极的语气,忽略无用的单词。<br style="line-height:22px"><br style="line-height:22px"><strong style="line-height:22px">Comment Types注释类型</strong><br style="line-height:22px"><br style="line-height:22px"><wbr><wbr>35.Use documentation commentsto describe the programing interface.<br style="line-height:22px"><wbr><wbr>使用文档注释来描述程序接口。<br style="line-height:22px"><br style="line-height:22px"><wbr><wbr>36.Use standard comments tohide code without removing it.<br style="line-height:22px"><wbr><wbr>使用标准注释来隐藏代码而不是删除。<br style="line-height:22px"><br style="line-height:22px"><wbr><wbr>37.Use one-line comments toexplain implementation details.<br style="line-height:22px"><wbr><wbr>使用单行注释来解释实现细节。<br style="line-height:22px"><br style="line-height:22px"><strong style="line-height:22px">Documentation Comments文档注释</strong><br style="line-height:22px"><br style="line-height:22px"><wbr><wbr>38.Describe the programinginterface before you write the code.<br style="line-height:22px"><wbr><wbr>在写代码之前描述程序接口。<br style="line-height:22px"><br style="line-height:22px"><wbr><wbr>39.Document public, protected,package, and private members.<br style="line-height:22px"><wbr><wbr>对public、protected、<wbr style="line-height:22px">package和private成员进行文档注释。<br style="line-height:22px"><wbr><wbr><br style="line-height:22px"><wbr><wbr>40.Provide a summarydescription and overview for each package.<br style="line-height:22px"><wbr><wbr>对每一个包提供概述。<br style="line-height:22px"><wbr><wbr><br style="line-height:22px"><wbr><wbr>41.Provide a summarydescription and overview for each application or group ofpackages.<br style="line-height:22px"><wbr><wbr>对每一个应用或者包的组提供概述。<br style="line-height:22px"><wbr><wbr><br style="line-height:22px"><strong style="line-height:22px"><wbr><wbr>CommentStyle 注释样式</wbr></wbr></strong><br style="line-height:22px"><br style="line-height:22px"><wbr><wbr> 42.Use a single consistentformat and organization for all documentation comments.<br style="line-height:22px"><wbr><wbr> 对于所有的文档注释坚持使用一种格式。<br style="line-height:22px"><wbr><wbr><wbr><br style="line-height:22px"><wbr><wbr> 43.Wrap keywords, identifiers,and constants with<code>...</code>tags.<br style="line-height:22px"><wbr><wbr>使用<code>...</code>标记包装关键字、<wbr style="line-height:22px">识别符和常量。<br style="line-height:22px"><br style="line-height:22px"><wbr><wbr> 44.Wrap code with<pre>...</pre>tags.<br style="line-height:22px"><wbr><wbr>使用<pre>...</pre>标记包装代码。<br style="line-height:22px"><br style="line-height:22px"><wbr><wbr> 45.Consider marking the firstoccurrence of an identifier with a {@link} tag.<br style="line-height:22px"><wbr><wbr>考虑在标识符第一次出现时使用{@link}标记。<br style="line-height:22px"><br style="line-height:22px"><wbr><wbr> 46.Establish and use a fixedordering for Javadoc tags.<br style="line-height:22px"><wbr><wbr>对于Javadoc标记应该建立并使用一种固定的顺序。<br style="line-height:22px"><br style="line-height:22px"><wbr><wbr> 47.Write in the third-personnarrative form.<br style="line-height:22px"><wbr><wbr> 以第三人称的叙述形式写。<br style="line-height:22px"><wbr><wbr><wbr><br style="line-height:22px"><wbr><wbr> 48.Write summary descriptionsthat stand alone.<br style="line-height:22px"><wbr><wbr> 写概述应该独立。<br style="line-height:22px"><wbr><wbr><wbr><br style="line-height:22px"><wbr><wbr> 49.Omit the subject in summarydescriptions of actions or services.<br style="line-height:22px"><wbr><wbr> 在概述中忽略目标。<br style="line-height:22px"><wbr><wbr><wbr><br style="line-height:22px"><wbr><wbr> 50.Omit the subject and theverb in summary descriptions of things.<br style="line-height:22px"><wbr><wbr> 在事物的概述中忽略目标和动词。<br style="line-height:22px"><br style="line-height:22px"><wbr><wbr> 51.Use "this" rather than"the" when referring to instance of current class.<br style="line-height:22px"><wbr><wbr>当指代当前类的实例时,用"this"而不是"the"。<br style="line-height:22px"><wbr><wbr><wbr><br style="line-height:22px"><wbr><wbr> 52.Do not add parentheses to amethod or constructor name unless you want to specify a particularsignature.<br style="line-height:22px"><wbr><wbr>不要对方法或构造函数名增加括号,除非你想表示特定的签名。<br style="line-height:22px"><br style="line-height:22px"><wbr><wbr><strong style="line-height:22px">Comment Content 注释内容</strong><br style="line-height:22px"><br style="line-height:22px"><wbr><wbr> 53.Provide a summarydescription for each method.<br style="line-height:22px"><wbr><wbr> 给每一个方法提供概述。<br style="line-height:22px"><br style="line-height:22px"><wbr><wbr> 54.Fully describe thesignature of each method.<br style="line-height:22px"><wbr><wbr> 完整描述每一方法签名。<br style="line-height:22px"><br style="line-height:22px"><wbr><wbr> 55.Include examples.<br style="line-height:22px"><wbr><wbr> 包含示例。<br style="line-height:22px"><br style="line-height:22px"><wbr><wbr> 56.Document preconditions,postconditions, and invariant conditions.<br style="line-height:22px"><wbr><wbr> 对前置、后置、不变条件进行文档注释。<br style="line-height:22px"><wbr><wbr><wbr><br style="line-height:22px"><wbr><wbr> 57.Document known defects anddeficiencies.<br style="line-height:22px"><wbr><wbr> 对已知的缺陷和不足进行文档注释。<br style="line-height:22px"><wbr><wbr><wbr><br style="line-height:22px"><wbr><wbr> 58.Document synchronizationsemantics.<br style="line-height:22px"><wbr><wbr> 对同步语法进行文档注释。<br style="line-height:22px"><wbr><wbr><wbr><br style="line-height:22px"><strong style="line-height:22px">Internal Comments内部注释</strong><br style="line-height:22px"><br style="line-height:22px"><wbr><wbr>59.Add internal comments onlyif they will aid others in understanding your code.<br style="line-height:22px"><wbr><wbr>只有当内部注释有助于其他人理解你的代码时才添加。<br style="line-height:22px"><wbr><wbr><br style="line-height:22px"><wbr><wbr>60.Describe why the code isdoing what it does, not what the code is doing.<br style="line-height:22px"><wbr><wbr>描述代码为什么那样做,而不是做了什么。<br style="line-height:22px"><br style="line-height:22px"><wbr><wbr>61.Avoid the use of end-linecomments.<br style="line-height:22px"><wbr><wbr>避免使用行尾注释。<br style="line-height:22px"><wbr><wbr><br style="line-height:22px"><wbr><wbr>62.Explain local variabledeclarations with an end-line comment.<br style="line-height:22px"><wbr><wbr>使用行尾注释解释局部变量声明。<br style="line-height:22px"><wbr><wbr><br style="line-height:22px"><wbr><wbr>63.Establish and use a set ofkeywords to flag unresolved issues.<br style="line-height:22px"><wbr><wbr>建立并使用一套关键字来标记未确定的情况。<br style="line-height:22px"><wbr><wbr style="line-height:22px"><br></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>
1.Adhere to the style of the original.
保持最初的样式。
2.Adhere to the Principle of Least Astonishment.
遵守最小惊奇原则。
3.Do it right the first time.
第一次就应当做好。
4.Document any deviations.
对于任何背离都应当文档注释。
Formatting Conventions格式约定
5.Indent nested code.
约束嵌套代码。
6.Break up long lines.
拆分长行。
7.Include white space.
包含空格。
8.Do not use "hard" tabs.
不要使用tab键。
Naming Conventions命名约定
9.Use meaningful names.
使用有意义的名称。
10.Use familiar names.
使用熟悉的名称。
11.Question excessively long names.
不要使用过长的名称。
12.Join the vowel generation.
加入元音字母。
13.Capitalize only the first letter in acronyms.
只对简称的第一个字母大写。
14.Do not use names that differ only in case.
不要使用只依赖于大小写来区分的名称。
PackageNames<wbr><wbr>包命名</wbr></wbr>
<wbr><wbr>15.Use the reversed, lowercaseform of your organization's Internet domain name as the rootqualifier for your package names.<br style="line-height:22px"><wbr><wbr>采用你组织的Internet域名的反转、<wbr style="line-height:22px">小写形式作为包名称的根限定词。<br style="line-height:22px"><br style="line-height:22px"><wbr><wbr>16.Use a single, lowercase wordas the root name of each package.<br style="line-height:22px"><wbr><wbr>使用一个唯一的小写单词作为每个包的根名称。<br style="line-height:22px"><br style="line-height:22px"><wbr><wbr>17.Use the same name for a newversion of a package, but only if that new version is still binarycompatible with the previous versin, otherwise, use a newname.<br style="line-height:22px"><wbr><wbr>只有当包的新版本仍然与旧版本兼容时,<wbr style="line-height:22px">对于包的新版本使用相同的名称,否则使用新名称。<br style="line-height:22px"><wbr><wbr><br style="line-height:22px"><strong style="line-height:22px">Type Names类型命名</strong><br style="line-height:22px"><br style="line-height:22px"><wbr><wbr>18.Capitalize the first letterof each word that appears in a class or interface name.<br style="line-height:22px"><wbr><wbr>对于类和接口名称只对每个单词的第一个字母大写。<br style="line-height:22px"><wbr><wbr><br style="line-height:22px"><strong style="line-height:22px"><wbr><wbr>ClassNames<wbr><wbr>类命名</wbr></wbr></wbr></wbr></strong><br style="line-height:22px"><br style="line-height:22px"><wbr><wbr> 19.Use nouns when namingclasses.<br style="line-height:22px"><wbr><wbr> 使用名词来命名类。<br style="line-height:22px"><wbr><wbr><wbr><br style="line-height:22px"><wbr><wbr> 20.Pluralize the names ofclasses that group related attributes, static services, orconstants.<br style="line-height:22px"><wbr><wbr>对于成组的相关属性、静态服务和常量,类名称采用复数形式。<br style="line-height:22px"><wbr><wbr><br style="line-height:22px"><wbr><wbr><strong style="line-height:22px">Interface Names 接口命名</strong><br style="line-height:22px"><br style="line-height:22px"><wbr><wbr> 21.Use nouns or adjectiveswhen naming interfaces.<br style="line-height:22px"><wbr><wbr> 使用名词或形容词来命名接口。<br style="line-height:22px"><br style="line-height:22px"><strong style="line-height:22px">MethodNames<wbr><wbr>方法命名</wbr></wbr></strong><br style="line-height:22px"><br style="line-height:22px"><wbr><wbr>22.Use lowercase for the firstword and capitalize only the first letter of each subsequent wordthat appears in a method name.]<br style="line-height:22px"><wbr><wbr>方法名称中第一个单词小写,<wbr style="line-height:22px">后续的每一个单词仅第一个字母大写。<br style="line-height:22px"><br style="line-height:22px"><wbr><wbr>23.Use verbs when namingmethods.<br style="line-height:22px"><wbr><wbr>使用动词来命名方法。<br style="line-height:22px"><br style="line-height:22px"><wbr><wbr>24.Follow the JavaBeansconventions for naming property accessor methods.<br style="line-height:22px"><wbr><wbr>命名属性访问方法遵守JavaBeans约定。<br style="line-height:22px"><br style="line-height:22px"><strong style="line-height:22px">Variable Names变量命名<wbr><wbr></wbr></wbr></strong><br style="line-height:22px"><br style="line-height:22px"><wbr><wbr>25.Use lowercase for the firstword and capitalize only the first letter of each subsequent wordthat appears in a variable name.<br style="line-height:22px"><wbr><wbr>变量名称中第一个单词小写,<wbr style="line-height:22px">后续的每一个单词仅第一个字母大写。<br style="line-height:22px"><br style="line-height:22px"><wbr><wbr>26.Use nouns to namefields.<br style="line-height:22px"><wbr><wbr>使用名词来命名成员变量。<br style="line-height:22px"><br style="line-height:22px"><wbr><wbr>27.Pluralize the names ofcollection reference.<br style="line-height:22px"><wbr><wbr>对于集合引用的名称采用复数形式。<br style="line-height:22px"><wbr><wbr><br style="line-height:22px"><wbr><wbr>28.Establish and use a set ofstandard names for trivial "throwaway" variables.<br style="line-height:22px"><wbr><wbr>对于通常的临时变量,建立并使用一套标准名称。<br style="line-height:22px"><wbr><wbr><br style="line-height:22px"><strong style="line-height:22px"><wbr><wbr>FieldNames 成员命名</wbr></wbr></strong><br style="line-height:22px"><br style="line-height:22px"><wbr><wbr> 29.Qualify field variableswith "this" to distinguish them from local variables.<br style="line-height:22px"><wbr><wbr>使用"this"限定成员变量以同局部变量区分。<br style="line-height:22px"><wbr><wbr><br style="line-height:22px"><strong style="line-height:22px">Parameter Names参数命名</strong><br style="line-height:22px"><br style="line-height:22px"><wbr><wbr> 30.When a constructor or "set"method assigns a parameter to a field, give that parameter the samename as the field.<br style="line-height:22px"><wbr><wbr>当构造函数或者"set"方法向成员分配参数时,<wbr style="line-height:22px">参数的命名应和成员相同。<br style="line-height:22px"><br style="line-height:22px"><strong style="line-height:22px">Constant Names常量命名</strong><br style="line-height:22px"><br style="line-height:22px"><wbr><wbr>31.Use uppercase letters foreach word and separate each pair of words with an underscore whennaming constants.<br style="line-height:22px"><wbr><wbr>当命名常量时,每个单词均大写,单词之间以下划线区分。<br style="line-height:22px"><br style="line-height:22px"><strong style="line-height:22px">Documentation Conventions文档约定</strong><br style="line-height:22px"><br style="line-height:22px"> 32.Write documentation for those who must use your code and thosemust maintain it.<br style="line-height:22px"> 为那些使用你代码和维护它的人写文档。<br style="line-height:22px"><br style="line-height:22px"> 33.Keep comments and code in sync.<br style="line-height:22px"> 保持注释与代码同步。<br style="line-height:22px"><br style="line-height:22px"> 34.Use the active voice and omit needless words.<br style="line-height:22px"> 使用积极的语气,忽略无用的单词。<br style="line-height:22px"><br style="line-height:22px"><strong style="line-height:22px">Comment Types注释类型</strong><br style="line-height:22px"><br style="line-height:22px"><wbr><wbr>35.Use documentation commentsto describe the programing interface.<br style="line-height:22px"><wbr><wbr>使用文档注释来描述程序接口。<br style="line-height:22px"><br style="line-height:22px"><wbr><wbr>36.Use standard comments tohide code without removing it.<br style="line-height:22px"><wbr><wbr>使用标准注释来隐藏代码而不是删除。<br style="line-height:22px"><br style="line-height:22px"><wbr><wbr>37.Use one-line comments toexplain implementation details.<br style="line-height:22px"><wbr><wbr>使用单行注释来解释实现细节。<br style="line-height:22px"><br style="line-height:22px"><strong style="line-height:22px">Documentation Comments文档注释</strong><br style="line-height:22px"><br style="line-height:22px"><wbr><wbr>38.Describe the programinginterface before you write the code.<br style="line-height:22px"><wbr><wbr>在写代码之前描述程序接口。<br style="line-height:22px"><br style="line-height:22px"><wbr><wbr>39.Document public, protected,package, and private members.<br style="line-height:22px"><wbr><wbr>对public、protected、<wbr style="line-height:22px">package和private成员进行文档注释。<br style="line-height:22px"><wbr><wbr><br style="line-height:22px"><wbr><wbr>40.Provide a summarydescription and overview for each package.<br style="line-height:22px"><wbr><wbr>对每一个包提供概述。<br style="line-height:22px"><wbr><wbr><br style="line-height:22px"><wbr><wbr>41.Provide a summarydescription and overview for each application or group ofpackages.<br style="line-height:22px"><wbr><wbr>对每一个应用或者包的组提供概述。<br style="line-height:22px"><wbr><wbr><br style="line-height:22px"><strong style="line-height:22px"><wbr><wbr>CommentStyle 注释样式</wbr></wbr></strong><br style="line-height:22px"><br style="line-height:22px"><wbr><wbr> 42.Use a single consistentformat and organization for all documentation comments.<br style="line-height:22px"><wbr><wbr> 对于所有的文档注释坚持使用一种格式。<br style="line-height:22px"><wbr><wbr><wbr><br style="line-height:22px"><wbr><wbr> 43.Wrap keywords, identifiers,and constants with<code>...</code>tags.<br style="line-height:22px"><wbr><wbr>使用<code>...</code>标记包装关键字、<wbr style="line-height:22px">识别符和常量。<br style="line-height:22px"><br style="line-height:22px"><wbr><wbr> 44.Wrap code with<pre>...</pre>tags.<br style="line-height:22px"><wbr><wbr>使用<pre>...</pre>标记包装代码。<br style="line-height:22px"><br style="line-height:22px"><wbr><wbr> 45.Consider marking the firstoccurrence of an identifier with a {@link} tag.<br style="line-height:22px"><wbr><wbr>考虑在标识符第一次出现时使用{@link}标记。<br style="line-height:22px"><br style="line-height:22px"><wbr><wbr> 46.Establish and use a fixedordering for Javadoc tags.<br style="line-height:22px"><wbr><wbr>对于Javadoc标记应该建立并使用一种固定的顺序。<br style="line-height:22px"><br style="line-height:22px"><wbr><wbr> 47.Write in the third-personnarrative form.<br style="line-height:22px"><wbr><wbr> 以第三人称的叙述形式写。<br style="line-height:22px"><wbr><wbr><wbr><br style="line-height:22px"><wbr><wbr> 48.Write summary descriptionsthat stand alone.<br style="line-height:22px"><wbr><wbr> 写概述应该独立。<br style="line-height:22px"><wbr><wbr><wbr><br style="line-height:22px"><wbr><wbr> 49.Omit the subject in summarydescriptions of actions or services.<br style="line-height:22px"><wbr><wbr> 在概述中忽略目标。<br style="line-height:22px"><wbr><wbr><wbr><br style="line-height:22px"><wbr><wbr> 50.Omit the subject and theverb in summary descriptions of things.<br style="line-height:22px"><wbr><wbr> 在事物的概述中忽略目标和动词。<br style="line-height:22px"><br style="line-height:22px"><wbr><wbr> 51.Use "this" rather than"the" when referring to instance of current class.<br style="line-height:22px"><wbr><wbr>当指代当前类的实例时,用"this"而不是"the"。<br style="line-height:22px"><wbr><wbr><wbr><br style="line-height:22px"><wbr><wbr> 52.Do not add parentheses to amethod or constructor name unless you want to specify a particularsignature.<br style="line-height:22px"><wbr><wbr>不要对方法或构造函数名增加括号,除非你想表示特定的签名。<br style="line-height:22px"><br style="line-height:22px"><wbr><wbr><strong style="line-height:22px">Comment Content 注释内容</strong><br style="line-height:22px"><br style="line-height:22px"><wbr><wbr> 53.Provide a summarydescription for each method.<br style="line-height:22px"><wbr><wbr> 给每一个方法提供概述。<br style="line-height:22px"><br style="line-height:22px"><wbr><wbr> 54.Fully describe thesignature of each method.<br style="line-height:22px"><wbr><wbr> 完整描述每一方法签名。<br style="line-height:22px"><br style="line-height:22px"><wbr><wbr> 55.Include examples.<br style="line-height:22px"><wbr><wbr> 包含示例。<br style="line-height:22px"><br style="line-height:22px"><wbr><wbr> 56.Document preconditions,postconditions, and invariant conditions.<br style="line-height:22px"><wbr><wbr> 对前置、后置、不变条件进行文档注释。<br style="line-height:22px"><wbr><wbr><wbr><br style="line-height:22px"><wbr><wbr> 57.Document known defects anddeficiencies.<br style="line-height:22px"><wbr><wbr> 对已知的缺陷和不足进行文档注释。<br style="line-height:22px"><wbr><wbr><wbr><br style="line-height:22px"><wbr><wbr> 58.Document synchronizationsemantics.<br style="line-height:22px"><wbr><wbr> 对同步语法进行文档注释。<br style="line-height:22px"><wbr><wbr><wbr><br style="line-height:22px"><strong style="line-height:22px">Internal Comments内部注释</strong><br style="line-height:22px"><br style="line-height:22px"><wbr><wbr>59.Add internal comments onlyif they will aid others in understanding your code.<br style="line-height:22px"><wbr><wbr>只有当内部注释有助于其他人理解你的代码时才添加。<br style="line-height:22px"><wbr><wbr><br style="line-height:22px"><wbr><wbr>60.Describe why the code isdoing what it does, not what the code is doing.<br style="line-height:22px"><wbr><wbr>描述代码为什么那样做,而不是做了什么。<br style="line-height:22px"><br style="line-height:22px"><wbr><wbr>61.Avoid the use of end-linecomments.<br style="line-height:22px"><wbr><wbr>避免使用行尾注释。<br style="line-height:22px"><wbr><wbr><br style="line-height:22px"><wbr><wbr>62.Explain local variabledeclarations with an end-line comment.<br style="line-height:22px"><wbr><wbr>使用行尾注释解释局部变量声明。<br style="line-height:22px"><wbr><wbr><br style="line-height:22px"><wbr><wbr>63.Establish and use a set ofkeywords to flag unresolved issues.<br style="line-height:22px"><wbr><wbr>建立并使用一套关键字来标记未确定的情况。<br style="line-height:22px"><wbr><wbr style="line-height:22px"><br></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>