代码风格最早出现的,也较为传统的是K&R风格。所谓K&R即指《The C Programming Language》一书的作者Kernighan和Ritchie二人,这是世界上第一本介绍C语言的书,而K&R风格即指他们在该书中书写代码所使用的风格。K&R风格在处理大括号时,使用了一种较为紧凑的格式,将左括号留在前一行的末尾,并尽可能地压缩·..
代码风格与注释和XML的比较。
那么,应当采用代码风格,还是用注释或XML声明方面呢?
So, should you go with the code style, or declare aspects using annotations or XML? Here's a summary of the trade-offs of AspectJ's Java code-based approach.
这种代码风格的使用从视觉上给出了一种强烈的指示:该类是一个不可变类。
Using this style of code is a strong visual indicator that it's an immutable class.
In general, good programming style says you put in comments that are going to be valuable in helping you as a reader understand what's going on inside of the code.
通常来说,优秀的编码风格意味着,你要放进去的注释,在帮助代码阅读者,理解代码内部,是怎么工作的。
Good programming style. All right? Things that we ought to do, as you put these pieces together in order to give you really good code.
优秀的编程风格,对不对?,为了得到真正优秀的代码,我们在把代码放到一起的时候。
OK. The other thing I want to say here, is that this style of program we just wrote is actually a very common one. And we're going to give it a nice little name, often referred to as exhaustive enumeration.
好,另外一件我想说的事情是,刚才我们写的代码的风格,是非常普通的,我们会给这个风格一个名字,通常是被称为详尽的列举。
应用推荐