[Robelle] [SmugBook] [Index] [Prev] [Next]

Elements of Programming Style, a Book Review

The book Elements of Programming Style, Kernighan and Plauger ( McGraw-Hill), is a classic guide to computer programming. Too many mediocre programs are still being written. Using another classic, Elements of Style (see English) for inspiration, the authors set out to demonstrate good programming styles. In their words, "the principles of style are applicable in all languages, including assembly codes."

A source program is written once, but will be read many times. Like English writing, program code must convey its meaning clearly and concisely. Many programmers still do not understand this simple concept. "The way to learn to program well is by seeing, over and over, how real programs can be improved by the application of a few principles of good practice and a little common sense. Practice in critical reading leads to skill in rewriting, which in turn leads to better writing."

The book uses PL/I and FORTRAN for examples, but the code should be clear, even for COBOL programmers. The authors develop a series of rules for writing good code. The complete set of rules will fit on three pages. Even if you don't read the book, remember this one rule:

"Use the telephone test for readability. If someone could understand your code when read aloud over the telephone, it's clear enough. If not, then it needs rewriting."

More ideas on software quality and productivity.


[Robelle] [SmugBook] [Index] [Quality] [Prev] [Next]