Objective of good layout
1. Accurately represent the logical structure of the code.
2. Consistently represent the logical structure of the code.
3. Improve readability
4. Withstand modifications.
Guidelines about control-structure blocks:
1. Avoid unindented begin-end pairs.
2. Avoid double indentation with begin and end.
3. Use blank lines between paragraphs.
4. Format single-statement blocks consistently.
5. For complicated expressions, put separate conditions on separate lines.
6. No endline exceptions for case statement.
7. Using only one statement per line.
Laying out comments
1. Indent a comment with its corresponding code.
2. Set off each comment with at least one blank line
Laying out routines.
1. Use blank lines to separate parts of a routine.
2. Use standard indentation for routine arguments.
博客介绍了良好代码布局的目标,包括准确、一致呈现代码逻辑结构,提高可读性和可修改性。还给出控制结构块的布局准则,如避免特定缩进方式、合理使用空行等。同时说明了注释和例程的排版方法,如注释与对应代码缩进一致等。
277

被折叠的 条评论
为什么被折叠?



