Topic: Java开发规范

  Print this page

1.Java开发规范 Copy to clipboard
Posted by: l_walker
Posted on: 2004-07-18 15:59

这是偶整理的一份开发规范文档,和各位共享,
本文档还在完善中,所以如果有任何bugSmile或意见、建议等
请联系我,以便修改和更新

tks

附件大小受限,100K也太小了吧!;)


download:
http://www.skyinn.org/downloads/JavaDevSpec.pdf

wiki:
http://www.skyinn.org/wiki/Wiki.jsp?page=JavaDevSpec

-------------------------------------------------------
目录:
-------------------------------------------------------

第1章 绪论 5
1.1 目的 5
1.2 范围 5
1.3 版权声明 5
1.4 参考资料 5
1.5 概述 5
第2章 代码组织与风格 7
2.1 基本原则 7
2.2 缩进 7
2.3 长度 7
2.4 行宽 7
2.5 间隔 7
2.6 对齐 7
2.7 括号 8
第3章 注释 9
3.1 基本原则 9
3.2 JAVADOC 9
3.3 文件与包注释 9
3.4 类、接口注释 10
3.5 方法注释 10
3.6 其他注释 11
3.7 注释参考表 11
第4章 命名 13
4.1 基本原则 13
4.2 文件、包 13
4.3 类、接口 13
4.4 字段 14
4.5 方法 14
4.6 异常 15
4.7 命名约定表 15
第5章 声明 17
5.1 基本原则 17
5.2 包 17
5.3 类、接口 17
5.4 方法 17
5.5 字段 18
5.6 示例 18
第6章 类与接口 20
6.1 基本原则 20
6.2 抽象类与接口 20
6.3 继承与组合 20
6.4 构造函数和静态工厂方法 20
6.5 TOSTRING(),EQUALS(),HASHCODE()... 20
6.6 SINGLETON CLASS 22
第7章 方法 23
7.1 基本原则 23
7.2 参数和返回值 23
第8章 表达式与语句 24
8.1 基本原则 24
8.2 控制语句 24
8.3 循环语句 25
第9章 错误与异常 26
9.1 基本原则 26
9.2 已检查异常与运行时异常 26
9.3 异常的捕捉与处理 26
第10章 测试与BUG跟踪 27
10.1 基本原则 27
10.2 测试驱动开发 27
10.3 JUNIT单元测试 27
10.4 自动测试与持续集成 27
10.5 BUG跟踪和缺陷处理 27
第11章 性能与安全 28
11.1 基本原则 28
11.2 STRING与STRINGBUGFFER 28
11.3 集合 28
11.4 对象 28
11.5 同步 28
11.6 FINAL 28
11.7 垃圾收集和资源释放 29
第12章 其他 30
12.1 目录结构 30
12.2 CVS注释与标记 31
12.3 31
第13章 附录 32
13.1 CVS标识符 32
13.2 注释模板 32
13.3 常用缩写简表 33
13.4 版权声明模板 33
13.5 示例代码 34

2.Re:Java开发规范 [Re: l_walker] Copy to clipboard
Posted by: 帅哥
Posted on: 2004-07-19 10:10

DOWN来看下!哈哈——

3.Re:Java开发规范 [Re: l_walker] Copy to clipboard
Posted by: xiaodong_1567
Posted on: 2004-07-31 10:05

我也试试

4.Re:Java开发规范 [Re: l_walker] Copy to clipboard
Posted by: yggl
Posted on: 2004-08-03 18:46

看下

5.Re:Java开发规范 [Re: l_walker] Copy to clipboard
Posted by: yikid
Posted on: 2004-08-04 11:54

不错。。

6.Re:Java开发规范 [Re: l_walker] Copy to clipboard
Posted by: xiazhencun
Posted on: 2004-08-14 12:40

制成chm就好了,我这里打不开这种文件格式,还得下载工具!

7.Re:Java开发规范 [Re: l_walker] Copy to clipboard
Posted by: wskyo
Posted on: 2004-08-18 13:06

多谢楼主

8.Re:Java开发规范 [Re: l_walker] Copy to clipboard
Posted by: CopyS
Posted on: 2004-08-26 15:22

刚下完还没看呢,给你顶顶

9.Re:Java开发规范 [Re: l_walker] Copy to clipboard
Posted by: lkck
Posted on: 2004-08-30 20:36

楼主是什么水平啊??

10.Re:Java开发规范 [Re: l_walker] Copy to clipboard
Posted by: xzpy00007
Posted on: 2004-09-01 20:14

very good ,this spirit is nobleness.not only valuable to yourself but also prefer to veryone.

11.Re:Java开发规范 [Re: l_walker] Copy to clipboard
Posted by: littledeer1974
Posted on: 2004-09-18 21:07

十分感谢,支持同行! Smile

12.Re:Java开发规范 [Re: l_walker] Copy to clipboard
Posted by: yyzky
Posted on: 2004-09-25 14:26

DOWN中谢谢楼主

13.Re:Java开发规范 [Re: l_walker] Copy to clipboard
Posted by: debug148
Posted on: 2004-10-06 10:07

me too

14.Re:Java开发规范 [Re: debug148] Copy to clipboard
Posted by: seawr
Posted on: 2004-10-07 16:14

that's good, any english version?

15.Re:Java开发规范 [Re: l_walker] Copy to clipboard
Posted by: sinboy
Posted on: 2004-10-18 12:33

做的非常不错,感谢楼主的努力。

我大概浏览了一下,有几个地方不觉得没有必要定义的那样严格,比如:
你在文中提到的变量对齐、参数对齐、条件对齐,如果能完全做到确实比较整齐好看,但不一定非得这样死般,况且变量对齐也不好做到,也许你在前面很费劲的把它对齐了,可是在程序编写的过程中你可能需要添加一个比前面的变量名都长的变量,可能还得重新对变量的布局进行重新的调整,这对程序开发来说显然比较浪费时间和精力。

个人观点,不知正确否?

16.Re:Java开发规范 [Re: l_walker] Copy to clipboard
Posted by: YuLimin
Posted on: 2004-10-18 12:58

我更喜欢

{
//....
}

一一对齐的风格!

17.Re:Java开发规范 [Re: l_walker] Copy to clipboard
Posted by: fishbob
Posted on: 2004-10-19 10:56

规范定的很容易,但是能严格遵守就不容了
还是感谢楼主的努力~~!

18.Re:Java开发规范 [Re: fishbob] Copy to clipboard
Posted by: cjsdn_an
Posted on: 2004-10-21 15:16

fishbob wrote:
规范定的很容易,但是能严格遵守就不容了
还是感谢楼主的努力~~!

同感~~~

19.Re:Java开发规范 [Re: l_walker] Copy to clipboard
Posted by: wulongfei
Posted on: 2004-10-21 16:11

感谢楼主!

20.Re:Java开发规范 [Re: l_walker] Copy to clipboard
Posted by: l_walker
Posted on: 2004-10-24 13:31

Tks everybody.

A new online URL is:
http://meteor.dev.java.net/files/documents/2278/8001/JavaDevelopmentSpecification.pdf

It's my first open source project on java.net,named Meteor.
A code generator tool for J2EE application that based on Struts,Spring,Hibernate...

I commited the source code today,but I have no time to finish the document because I'm looking for a new job now in Shanghai.
So if you want to use this tool,see the source code and run the demo,
but don't run with Ant using the default build.xml because the another project is not aviable now.I will commit it later.
Any question pls send to mail_hanqing {a} yahoo.com

21.Re:Java开发规范 [Re: l_walker] Copy to clipboard
Posted by: angela5978
Posted on: 2004-10-27 13:44

好东东

22.Re:Java开发规范 [Re: l_walker] Copy to clipboard
Posted by: kylin
Posted on: 2004-10-29 16:05

无论如何,顶一下

23.Re:Java开发规范 [Re: sinboy] Copy to clipboard
Posted by: gechun0214
Posted on: 2004-10-29 18:21

好东西,我顶!!!!

24.Re:Java开发规范 [Re: l_walker] Copy to clipboard
Posted by: selina
Posted on: 2004-11-07 16:44

thanks

25.Re:Java开发规范 [Re: l_walker] Copy to clipboard
Posted by: lwwbill
Posted on: 2004-11-08 15:30

刚下完

26.Re:Java开发规范 [Re: l_walker] Copy to clipboard
Posted by: luyingnbanbanba
Posted on: 2004-11-19 11:05

硬顶!哈哈

27.Re:Java开发规范 [Re: l_walker] Copy to clipboard
Posted by: april518
Posted on: 2004-11-28 12:17

谢谢大哥!

28.Re:Java开发规范 [Re: l_walker] Copy to clipboard
Posted by: lczhongj
Posted on: 2005-01-10 16:52

谢谢了,顶!!!

29.Re:Java开发规范 [Re: l_walker] Copy to clipboard
Posted by: softxi
Posted on: 2005-01-11 14:47

好人啊。

30.Re:Java开发规范 [Re: l_walker] Copy to clipboard
Posted by: softxi
Posted on: 2005-01-11 14:48

好人啊。

31.Re:Java开发规范 [Re: l_walker] Copy to clipboard
Posted by: mikeshuang
Posted on: 2005-02-20 19:45

谢谢拉

32.Re:Java开发规范 [Re: l_walker] Copy to clipboard
Posted by: wjh2004
Posted on: 2005-02-24 15:37

DOWN来看下

33.Re:Java开发规范 [Re: l_walker] Copy to clipboard
Posted by: pyjiang
Posted on: 2005-03-04 09:03

下了,谢谢.

34.jsp与session [Re: l_walker] Copy to clipboard
Posted by: ottffsse
Posted on: 2005-03-06 22:32

请教:在JSP中可以使用session吗?

35.Re:Java开发规范 [Re: fishbob] Copy to clipboard
Posted by: another
Posted on: 2005-03-18 17:18

fishbob wrote:
规范定的很容易,但是能严格遵守就不容了
还是感谢楼主的努力~~!


在国内,好像只能用扣工资来严格遵守。。。

36.Re:jsp与session [Re: ottffsse] Copy to clipboard
Posted by: another
Posted on: 2005-03-18 17:18

ottffsse wrote:
请教:在JSP中可以使用session吗?

可以。

37.Re:Java开发规范 [Re: l_walker] Copy to clipboard
Posted by: century_zw
Posted on: 2005-04-06 13:48

我正在找一些开发规范,谢谢楼主!
顶。。。

38.Re:Java开发规范 [Re: l_walker] Copy to clipboard
Posted by: kingomanner
Posted on: 2005-04-13 20:51

能做出这样的规范,看来没点功底是不行,楼主够厉害!佩服佩服!
请问这也是您的一个项目吧?
能否告知做规范性的东西最关键的是什么原则?有没有管理规范方面的东西可供参考呢?

39.Re:Java开发规范 [Re: l_walker] Copy to clipboard
Posted by: sentven
Posted on: 2005-04-16 11:15

谢谢啦

40.Re:Java开发规范 [Re: kingomanner] Copy to clipboard
Posted by: l_walker
Posted on: 2005-04-16 11:49

kingomanner wrote:
能做出这样的规范,看来没点功底是不行,楼主够厉害!佩服佩服!
请问这也是您的一个项目吧?
能否告知做规范性的东西最关键的是什么原则?有没有管理规范方面的东西可供参考呢?


follow it!

定个规范很容易,但让所有人遵守确很难,需要制度什么的莱保证。
我们team在code review时如果发现不符合规范的地方就会报defect

41.Re:Java开发规范 [Re: l_walker] Copy to clipboard
Posted by: kingomanner
Posted on: 2005-04-16 19:22

说的好,规范制定的目的就是要人来遵守,如果没人去遵守,行业的标准化进程就有麻烦了!
但话又所回来,首先就是需求分析,有必要的话,就要制定相应的规范来保证某行业的规范化,但规范是对人对事的一系列约束,涉及的面比较广,一般都有章可循,您这方面有什么独到的经验吗?不吝赐教啊!

42.Re:Java开发规范 [Re: l_walker] Copy to clipboard
Posted by: l_walker
Posted on: 2005-04-17 17:32

可以参考RUP,虽然那东西比较烦,不过对于标准化,规范化很有帮助:)

43.Re:Java开发规范 [Re: l_walker] Copy to clipboard
Posted by: fighterx28
Posted on: 2005-04-19 23:19

thanks...

44.Re:Java开发规范 [Re: l_walker] Copy to clipboard
Posted by: zwrm
Posted on: 2005-04-23 17:02

多谢.是位好同志.

45.Re:Java开发规范 [Re: l_walker] Copy to clipboard
Posted by: cqjjhsj
Posted on: 2005-06-07 09:21

还真是自己写的哦!向前辈们学习!

46.Re:Java开发规范 [Re: l_walker] Copy to clipboard
Posted by: hujava
Posted on: 2005-06-12 15:51

多谢

47.Re:Java开发规范 [Re: l_walker] Copy to clipboard
Posted by: ankl
Posted on: 2005-06-13 13:06

good.

48.Re:Java开发规范 [Re: l_walker] Copy to clipboard
Posted by: l_walker
Posted on: 2005-06-23 09:40

Cause my site will close, the avilible link will charge to :

https://meteor.dev.java.net/files/documents/2278/8001/JavaDevelopmentSpecification.pdf

if you couldn't got it ,please access dev.java.net and find my project:meteor, the artical was under project's document/documentation folder.

if anybody have interesting with this project, please let me know,
I want to refactor this project for more easy and power to use.

thanks everybody.

l_walker

49.Re:Java开发规范 [Re: l_walker] Copy to clipboard
Posted by: zuolongjava
Posted on: 2005-07-06 20:36

下是下来了,但是打不开呀!可能是没装这个软件吧!

50.Re:Java开发规范 [Re: l_walker] Copy to clipboard
Posted by: am2000
Posted on: 2005-07-26 09:40

thanks

51.Re:Java开发规范 [Re: l_walker] Copy to clipboard
Posted by: digital2003
Posted on: 2005-07-26 16:36

怎么下载不了??????
真是郁闷啊,
小弟的email :digital2003@126.com
哪位好心人,有的话,寄过来吧?

52.Re:Java开发规范 [Re: l_walker] Copy to clipboard
Posted by: hyhking
Posted on: 2005-08-18 09:30

下不了啊

53.Re:Java开发规范 [Re: l_walker] Copy to clipboard
Posted by: 198run
Posted on: 2005-09-07 20:43

谢谢

54.Re:Java开发规范 [Re: l_walker] Copy to clipboard
Posted by: zhaoxlliuf
Posted on: 2005-09-16 15:17

好,不错,谢谢楼主

55.Re:Java开发规范 [Re: l_walker] Copy to clipboard
Posted by: bukaoyan
Posted on: 2005-09-30 10:11

怎么下载不了了啊?

56.Re:Java开发规范 [Re: l_walker] Copy to clipboard
Posted by: yt_guo
Posted on: 2005-10-09 16:44

下载不了,郁闷中,楼主,救命

57.Re:Java开发规范 [Re: l_walker] Copy to clipboard
Posted by: steaker
Posted on: 2005-10-09 22:00

怎么不能下在阿?

58.Re:Java开发规范 [Re: l_walker] Copy to clipboard
Posted by: yuyouyu
Posted on: 2005-10-12 09:44

支持楼主!!!

59.Re:Java开发规范 [Re: l_walker] Copy to clipboard
Posted by: hcwyh
Posted on: 2005-10-13 13:58

下为看一看,谢谢楼主

60.Re:Java开发规范 [Re: l_walker] Copy to clipboard
Posted by: 1128
Posted on: 2005-11-14 12:51

nbv

61.Re:Java开发规范 [Re: l_walker] Copy to clipboard
Posted by: fjtyh
Posted on: 2005-11-14 13:06

我不能下ConfusedCry

62.Re:Java开发规范 [Re: l_walker] Copy to clipboard
Posted by: fyg1984
Posted on: 2008-02-02 12:59

不顶不行啊

63.Re:Java开发规范 [Re: l_walker] Copy to clipboard
Posted by: zfpei168
Posted on: 2008-02-24 06:12

多谢楼主

64.Re:Java开发规范 [Re: l_walker] Copy to clipboard
Posted by: pochonlee
Posted on: 2008-05-17 23:18

楼主同志,下不下来啊??

65.Re:Java开发规范 [Re: l_walker] Copy to clipboard
Posted by: ahyum
Posted on: 2008-05-23 17:01

DOWN中谢谢楼主 ~


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923