img wangjiong

Layout and Style

发表于2004/10/27 23:04:00  617人阅读

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.

0 0


取 消