JAVA编码规范(亚信科技) 下载本文

内容发布更新时间 : 2024/11/13 5:16:05星期一 下面是文章的全部内容请认真阅读。

AsiaInfo 项目管理文档 JAVA编程规范 软件规范 编写 审批 文档版本 liuwei 刘丰(研发部总经理) V2.0 编写时间 审批时间 2005-04-10 2005-8-18 亚信科技(中国)有限公司版权所有 文档中的全部内容属亚信科技(中国)有限公司所有, 未经允许,不可全部或部分发表、复制、使用于任何目的。

文档修订摘要

日期 2005-4-10 修订号 1 建立 描述 著者 祁麟 审阅者 日期 亚信科技(中国)有限公司版权所有

文档中的全部内容属亚信科技(中国)有限公司所有, 未经允许,不可全部或部分发表、复制、使用于任何目的。

目录

1

基本概念 ···························································································································· 1 1.1 1.2 2

命名 ···························································································································· 1 文档注释 ····················································································································· 1

成员函数规范 ····················································································································· 1 2.1 命名 ···························································································································· 1 2.2 文档注释 ····················································································································· 2 2.3 2.4

编写整洁清晰代码的技巧 ···························································································· 3 编码的技巧 ················································································································· 3

3

变量属性规范 ····················································································································· 4

3.1 字段的命名 ················································································································· 4 3.2 3.3 3.4

字段的可视性 ·············································································································· 4 字段的文档注释 ·········································································································· 4 使用成员访问方法 ······································································································· 5

4

局部变量规范 ····················································································································· 6

4.1 命名 ···························································································································· 6

4.2 声明和注释局部变量 ··································································································· 6 5 成员函数的参数规范 ·········································································································· 7 5.1 5.2 5.3 6

参数的命名 ················································································································· 7 参数的说明注释 ·········································································································· 7 指定参数类型 ·············································································································· 7

类,接口,包和编译单元规范 ···························································································· 7

6.1 类的规范 ····················································································································· 7

6.2 接口的规范 ················································································································· 8 6.3 包的规范 ····················································································································· 8 6.4 编译单元规范 ·············································································································· 8 7 其它规范 ···························································································································· 9 7.1 7.2 7.3

重用 ···························································································································· 9 类的引入 ····················································································································· 9 优化代码 ····················································································································· 9

ii