The Elements of Programming Style

Abstracted from the appendix Summary Of Rules in The Elements of Programming Style (Second Edition) by Brian W. Kernighan and P. J. Plauger, pub. McGraw-Hill, ISBN 0-07-034207-5.

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're certain of doing as well, you will probably do best to follow the rules.

Introduction

Expressions

Control Structure

Program Structure

Input and Output

Common Blunders

Efficiency and Instrumentation

Documentation