Tommy Usher is president of RENT-A-HACK, a low-cost computer consulting firm. He also does freelance programming. He can be reached at hacker3000@ao1.com.
Code Complete by Steve McConnell provides a good overview of a wide range of programming topics. Though the book is described on the cover as "A Practical Guide to Software Construction," in fact it ventures well beyond the practical and into what McConnell might call the "philosophy" of good programming. Code Complete doesn't provide all of the answers, but is a good place to start.
Audience
The author lists three groups who he feels should read this book: experienced programmers, who want a comprehensive guide to software construction, self-taught programmers, who are looking to learn more effective programming practices, and students making the transition from an academic environment to a professional one.
Content
The book is divided into eight sections:1. Laying the Foundation
2. Design
3. Data
4. Control
5. Constant Considerations
6. Quality Improvement
7. Final Steps
8. Software Craftsmanship
Each of these sections contains several chapters on more specific topics. McConnell uses special symbols throughout the book to alert the reader to key points, hard data, suggestions for further reading, and what he calls coding horrors. (This last item provides examples of how not to program.) Many of the chapters include a check list designed to serve as a quick reference for the chapter's contents.
The first section, "Laying the Foundation," deals with the concept of software construction and provides a philosophical basis for the material which follows. It begins with a definition of software construction, followed by a discussion of the various metaphors that programmers use to understand programming. (Does one "build" a program or "grow" it?) The author then discusses the prerequisites to coding.
The next section deals with the design of software. Here McConnell introduces concepts such as routines, modules, and Program Design Language (PDL). The section includes a discussion of design methodologies, with special emphasis on structured and object-oriented design. It concludes with a description of "round-trip design," which seeks to combine the ideas of the other design methodologies and apply the best-suited method to each problem.
The "Data" section puts the concept of data structures in practical terms. The emphasis is not on the structures themselves but on how to use them efficiently. Subjects covered include general issues, variable names, and data types.
The "Control" section begins with straight-line code and moves through the various types of control structures, including conditionals, loops, and unusual control structures such as goto, return, and recursion.
The chapter on unusual control structures is one of the best in the book and possibly one of the most controversial. The author provides one of the best discussions of the goto issue I have read. He is balanced but cautious in his treatment of goto. His conclusion is that in nine out of ten cases, gotos can be easily eliminated. Of the remaining one in ten, nine out of those ten can be eliminated with reasonable effort. That leaves one in 100 gotos that are actually necessary. This may annoy those who feel gotos must never be used, but he makes a reasoned and logical argument for his position. Further, he provides reasonable guidelines for the proper use of gotos.
Another area where he provides useful information is when and how to use recursion. An interesting section shows that the classic textbook examples illustrating recursion calculating factorials and Fibonacci numbers are both confusing and misleading. The section concludes with a discussion of general control issues, and a closer look at structured programming.
The "Constant Considerations" section covers issues that programmers face everyday, like layout, style, documentation, tools, and management. Here again, McConnell tackles areas of controversy (that some programmers approach with religious fervor) with balance and moderation. His ideas on program layout and style will not please everyone for example, I prefer a different style of indentation. Still, they deserve consideration and provide interesting ideas. On the subject of comments, he tells an amusing story about a group of philosophers debating their various philosophies of commenting. Other chapters deal with programming tools, the relationship between size and software construction, and management. Management is examined from both the manager's and the programmer's points of view.
The next section is called "Quality Improvement." In this section the author first gives an overview of software quality, then addresses some specific subjects. Reviewing, unit testing, and debugging are examined in this section. Each subject is treated in depth and McConnell suggests techniques and tools that can help ensure the quality of a program.
Some additional topics related to quality improvement are discussed in the next section, "Final Steps." Here the emphasis is on system integration, code tuning, and software evolution. In a world of increasingly larger and larger software packages, these are important chapters. One interesting and potentially controversial concept introduced in the chapter on integration is evolutionary delivery. This scheme calls for the developer to deliver the software at successive levels of completion. The initial delivery is the core of the ultimate product. Subsequent deliveries add capabilities, improve interfaces and performance, and ultimately lead to a fully functional product. These techniques seem to me more suited to development for in-house use but the author is advocating them for commercial releases. His discussion of evolutionary delivery almost seems a defense of releasing an unfinished product with the intention of insuring future sales. (During the development of a spreadsheet, for example, file operations are not added until the third delivery.) This chapter seems to provide a solid basis for the truism that one should never purchase any software with a version number ending in zero.
The last section of the book is on "Software Craftsmanship." The first chapter in this section deals with what may seem a strange topic: personal character. McConnell argues that character is a legitimate topic of discussion and proceeds to describe the characteristics of good programmers. The next chapter deals with several different themes related to software craftsmanship: complexity, processes, iteration, and religion. By religion he of course refers to the various issues, such as use of goto, layout style, and program structure, that programmers become emotional about. The book ends with a real gem of a chapter called "Where to Go for More Information." Here he gives suggestions, both specific and general, for various books that should be in the library of the software professional. He also suggests periodicals, professional organizations, and sources for books on programming.
Commentary
Whatever your background, "Code Complete" has something to offer you. Even the most experienced C programmer will find ideas for improvement. The author writes in an entertaining style and makes good use of code segments to illustrate his points.Not everyone will be pleased with everything McConnell says. Since he deals with subjects that many programmers are very emotional about, some readers will no doubt object to his suggestions. Still, this book will benefit any programmer who approaches it with an open mind. Even when I disagreed with the author's approach, I could see his point. I was pleasantly surprised by his willingness to challenge coventional wisdom.
The book is very well organized. Each chapter is cross-referenced to areas of similar interest, and references to other works are in the margins rather than at the end of the chapters. (It might be interesting to covert this book to an online form. The extensive cross-references almost seem to have been created with this in mind.)
Code Complete should be required reading for anyone who plans to begin or continue a career in software development. It won't teach you how to be a C programmer, but it could help make you a more productive one.
Title: Code Complete
Author: Steve McConnell
Publisher: Microsoft Press
Price: $35.00
ISBN: 1-55615-484-4
Pages: 880