JAVA语言代码规范(含外文出处)
英文翻译
JAVA语言代码规范(含外文出处)(中文2400字,英文2400字)
作者姓名:Peter King, Patrick Naughton
文章出处:《Code Conventions for the JavaTM Programming Language》
摘要:文本简要的介绍了在JAVA编码时所注意的命名规范,包括代码的注释、代码的缩行、语句的返回等格式。
关键字:JAVA代码规范 JAVA代码注释
JAVA语言代码规范
1 为什么需要代码规范
由于以下几个原因,使得代码规范对开发者来说显得重要:
• 80%的项目生命期处于维护阶段。
• 几乎所有的软件都不是由最初的作者在进行维护。
• 代码规范改善了软件可读性,允许更快、更彻底的理解新代码。
• 如果在产品中使用了您的源代码,您需要确信代码对产品来说是封装良好的。
英文原文
CodeConventions for the JavaTM Programming Language
1 Why Have Code Conventions
Code conventions are important to programmers for a number of reasons:
• 80% of the lifetime cost of a piece of software goes to maintenance. [资料来源:http://www.doc163.com]
• 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.
• If you ship your source code as a product, you need to make sure it is as well packaged and clean as any other product you create.
2 Indentation
Four spaces should be used as the unit of indentation. The exact construction of the indentation (spaces vs. tabs) is unspecified. Tabs must be set exactly every 8 spaces (not 4).
[资料来源:http://Doc163.com]