您可以在这里快速查找:


 
您的位置: 编程学习 > java教程 > 200511
文章分类

Java技术
2005: 03 04 05 06 07 08
09 10 11 12
2006: 01 02

Asp.net
2005: 07 08 09 10 11 12
2006: 01 02

VB编程
2006: 02

Asp编程
2005: 11 12
2006: 01 02

C++/VC
2005: 10 11 12
2006: 01 02

Delphi
2005: 12
2006: 01 02

其它

 本文章适合所有读者

Syntax 与style(conventions)

yqj2065

一、Java代码约定

       语法告诉我们what code it is possible to write—what the machine will understand,而约定(style、conventions)告诉我们what you ought to write—what the humans reading the code will understand.

       按照一致、简单的约定写出的代码,将是maintainable, robust, and contain fewer bugs.

       为什么需要约定,Sun给出的原因有:

  • 80% of the lifetime cost of a piece of software goes to maintenance.
  • Hardly any software is maintained for its whole life by the original author.
  • Code conventions improve the readability of the software, allowing engineers to understand new code more quickly and thoroughly.

 

编写Java代码常用的约定有两个:

 

二、TIOBE Coding Standard Methodology和Jacobe




see:http://www.tiobe.com/tpci.htm

代码美化工具:Jacobe,缺省包含了一个完全按照Sun的代码规范的格式化配置文件。