Sun公司代码规范.docx

  1. 1、本文档共10页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
Genaral Principles —般约定 Adhere to the style of the original. 保持最初的样式。 Adhere to the Principle of Least Astonishment. 遵守最小惊奇原则。 Do it right the first time. 第一次就应当做好。 Document any deviations. 对于任何背离都应当文档注释。 Formatting Conventions 格式约定 5」n dent nested code. 约束嵌套代码。 6.Break up long lines. 拆分长行。 7」n clude white space. 包含空格。 Do not use "hard" tabs. 不要使用tab键。 Naming Conventions 命名约定 Use meaningful names. 使用有意义的名称。 Use familiar names. 使用熟悉的名称。 ".Question excessively long names. 不要使用过长的名称。 Join the vowel generation. 加入元音字母。 Capitalize only the first letter in acronyms. 只对简称的第一个字母大写。 Do not use names that differ only in case. 不要使用只依赖于大小写来区分的名称。 Package Names 包命名 Use the reversed, lowercase form of your organization's Internet domain name as the root qualifier for your package names. 采用你组织的Internet域名的反转、小写形式作为包名称的根限定词。 Use a single, lowercase word as the root name of each package. 使用一个唯一的小写单词作为每个包的根名称。 Use the same name for a new version of a package, but only if that new version is still binary compatible with the previous versin, otherwise, use a new name. 只有当包的新版本仍然与旧版本兼容时,对于包的新版本使用相同的名称,否则使用新名称。 Type Names类型命名 Capitalize the first letter of each word that appears in a class or interface name. 对于类和接口名称只对每个单词的第一个字母大写。 Class Names 类命名 Use nouns when naming classes. 使用名词来命名类。 PIuralize the names of classes that group related attributes, static services, or constants. 对于成组的相关属性、静态服务和常量,类名称采用复数形式。 Inteface Names 接口命名 Use nouns or adjectives when naming interfaces. 使用名词或形容词来命名接口。 Method Names方法命名 Use lowercase for the first word and capitalize only the first letter of each subsequent word that appears in a method name.] 方法名称中第一个单词小写,后续的每一个单词仅第一个字母大写。 Use verbs when naming methods. 使用动词来命名方法。 Follow the JavaBeans conventions for naming property accessor methods. 命名属性访问方法遵守 JavaBeans约定。 Variable Names 变量命名 Use lowercase for the first word and capitalize only the first letter of each subsequent word that appears in a variable name. 变量名称中第一个单词小写,后续的每一个单词仅第一个字母大写。 Use nouns to name fi

文档评论(0)

niupai11 + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档