The Psychology of Quality and More |
CHAPTER 6 : Layout
6.3 Use of blank linesSpaces are used within a line to make individual items more readable, and to indicate the degree of association. Blank lines can be similarly used at the statement level to delimit larger chunks of information. These 'Breathing points' in the code are often good points at which to put comments, summing up what has, or what is about to, happen. A blank line is itself, in effect, a comment. It says, "Stop, take a breath, look back at what you just read. Did you understand it? Do you need to read it again? Look forwards, can you see the next breathing point? Prepare to take in the next chunk":
MovePaperUp( CharHeight );
Statements naturally tend to come in small chunks. If the chunk is large (ie. more than about 7 lines), then you should be looking for points at which to insert blank lines and/or comments. The disadvantage of blank lines is that they increase the vertical size of the function, which means that there is less code visible at one time on the screen or page, which in turn means that it may be less easy to scan back (e.g. to find a variable).
|
Site Menu |
Quality: | Quality Toolbook | Tools of the Trade | Improvement Encyclopedia | Quality Articles | Being Creative | Being Persuasive | |
And: | C Style (Book) | Stories | Articles | Bookstore | My Photos | About | Contact | |
Settings: | Computer layout | Mobile layout | Small font | Medium font | Large font | Translate | |
You can buy books here |
And the big |