This summary is designed to give a quick review of the points we covered in the book. Remember as you read the rules that they were presented in connection with one or more examples – go back and reread the pertinent section if a rule doesn't call them to mind.
To paraphrase an observation in The Elements of Style, rules of programming style, like those of English, are sometimes broken, even by the best writers. When a rule is broken, however, you will usually find in the program some compensating merit, attained at the cost of the violation. Unless you are certain of doing as well, you will probably do best to follow the rules.
Write clearly - don't be too clever.
Say what you mean, simply and directly.
Use library functions.
Avoid temporary variables.
Write clearly - don't sacrifice clarity for "efficiency."
The Elements of Programming Style, by Brian W. Kernighan and P. J. Plauger, is a study of programming style, advocating the notion that computer programs should be written not only to satisfy the compiler, but also with human readers in mind (especially software maintenanceengineers).
SUMMARY OF RULES
This summary is designed to give a quick review of the points we covered in the book. Remember as you read the rules that they were presented in connection with one or more examples – go back and reread the pertinent section if a rule doesn't call them to mind.
To paraphrase an observation in The Elements of Style, rules of programming style, like those of English, are sometimes broken, even by the best writers. When a rule is broken, however, you will usually find in the program some compensating merit, attained at the cost of the violation. Unless you are certain of doing as well, you will probably do best to follow the rules.
Write clearly - don't be too clever.
Say what you mean, simply and directly.
Use library functions.
Avoid temporary variables.
Write clearly - don't sacrifice clarity for "efficiency."
Let the machine do the dirty work.
The Elements of Programming Style, by Brian W. Kernighan and P. J. Plauger, is a study of programming style, advocating the notion that computer programs should be written not only to satisfy the compiler, but also with human readers in mind (especially software maintenanceengineers).
The book pays explicit homage, in title and tone, to The Elements of Style, by Strunk & White.