Writing by Peter Hilton

Book review: Code Complete

A review of Code Complete, by Steve McConnell, with extracts from the book

Code Complete, Steve McConnel (Microsoft Press, 1993)

A strong focus on a single topic

Maastricht: the flag in the main square Code Complete is devoted to a single topic - writing code. This is more clearly defined than programming in general, because that is often taken to mean 'all of the different things that programmers do', including design, testing and integration.

Code Complete treats the subject intelligently, and is not distracted by side-issues, such as choice of programming language, or the latest buzz-word topics related to the subject. This is not a book about a particular programming language or technology; the examples in the book use whichever language best illustrates the point.

There is a difference between 'writing code' in general, and writing C++, say. For example, you wouldn't expect a book about C++ to deal with issues such as choice of variable names, because that isn't intrinsically a C++ issue. Of course, many computer books about a particular programming language do stray from the topic (just as I am doing now), and discuss programming in general.

A thorough treatment of writing code

Code Complete is a thick book because it gives a thorough treatment of a single subject, rather than just a shallow overview. This is an exception to the general rule that computer books that are more than 2 cm thick have little content  WHY? .

See the extracts from some of the 33 chapters below, for some idea of the breadth and level of detail in the book.

Balanced presentation of multiple views and clear advice

Maastricht: the terrace of Cafe de Percee Code Complete discusses alternative and conflicting viewpoints, set against both academic studies and the author's commercial experience. This lends a great deal authority to the content of the book, and is a combination rarely found in the IT section of your average bookshop.

The author also offers explicit and clearly-worded advice, which is refreshing and useful. As well as daring to be prescriptive, he is careful to indicate which issues are controversial, giving a balanced presentation of both sides of the argument. All of this makes the various suggestions much easier to understand and swallow.

Examples of advice from the book

The following extracts taken from ten of Code Complete's 33 chapters illustrate its style and the nature of the advice. A disproportionate number of the extracts chosen quote academic studies, as the clear way that these results are presented and tied in with the rest of the text is one of the book's major strengths. Page numbers are given for each quotation.

From Chapter 5 - Characteristics of high-quality routines:

From Chapter 6 - Three out of four programmers surveyed prefer modules:

Maastricht: clocks on lampposts are nothing out of the ordinary From Chapter 7 - High-level design in construction:

From Chapter 8 - Creating data:

From Chapter 9 - The power of data names:

From Chapter 11 - Fundamental data types:

From Chapter 12 - Complex data types:

From Chapter 13 - Organizing straight-line code:

Maastricht: sitting outside the Falstaff in summer, with a glass of Wickse Witte From Chapter 14 - Using conditionals:

From Chapter 15 - Controlling loops:

Share on TwitterShare on LinkedIn