目录
1.概述............................................................................................................................................................ 4
1.1 背景.................................................................................................................................................. 4
1.2 目的.................................................................................................................................................. 4
1.3 适用范围.......................................................................................................................................... 4
1.5 文档说明.......................................................................................................................................... 5
2.文件规范..................................................................................................................................................... 5
2.1 文件编码.......................................................................................................................................... 5
2.2 文件命名.......................................................................................................................................... 5
2.3 配置文件的选择...............................................................................................................................5
3.排版风格..................................................................................................................................................... 6
3.1 总原则.............................................................................................................................................. 6
3.2 列宽/换行......................................................................................................................................... 6
3.3 声明.................................................................................................................................................. 6
3.4 缩进.................................................................................................................................................. 7
3.5 空行.................................................................................................................................................. 8
3.6 空格.................................................................................................................................................. 8
3.7 对齐.................................................................................................................................................. 8
3.8 小括号.............................................................................................................................................. 9
3.9 花括号.............................................................................................................................................. 9
3.10 代码长度........................................................................................................................................ 9
4.命名规范..................................................................................................................................................... 9
4.1 命名总则.......................................................................................................................................... 9
4.2 命名空间........................................................................................................................................ 10
4.3 类与接口........................................................................................................................................ 10
4.4 方法................................................................................................................................................ 10
4.5 参数................................................................................................................................................ 11
4.6 属性................................................................................................................................................ 11
4.7 常量................................................................................................................................................ 11
4.8 变量................................................................................................................................................ 11
4.9 集合................................................................................................................................................ 12
4.10 异常.............................................................................................................................................. 12
4.11 控件.............................................................................................................................................. 12
4.12 关键字.......................................................................................................................................... 12
4.13 命名示例...................................................................................................................................... 13
5.语句规范................................................................................................................................................... 14
5.1 语句总则........................................................................................................................................ 14
5.2 循环语句........................................................................................................................................ 14
5.3Switch-case...................................................................................................................................... 15
6.注释规范................................................................................................................................................... 16
6.1 注释总则........................................................................................................................................ 16
6.2 文档注释........................................................................................................................................ 16
6.3 屏蔽代码........................................................................................................................................ 17
6.4 类注释............................................................................................................................................ 17
6.5 函数注释........................................................................................................................................ 18
6.6 代码注释........................................................................................................................................ 18
6.7 变量注释........................................................................................................................................ 19
6.8 修改别人的代码.............................................................................................................................19
6.9 单行注释........................................................................................................................................ 20
6.10 其他注释...................................................................................................................................... 20