In the preface to the first edition of Code Complete, Steve McConnell writes “I was sure when I conceived this book that someone else would already have written a book on effective construction practices .by someone who was knowledgeable enough about the theoretical state of the art but who was also building enough production code to appreciate the state of the practice.” That same sentence is in Code Complete, 2nd Edition, and is one of the only falsehoods in the book: the reason that for 10 years Code Complete has been a must-buy is not for lack of would-be competitors but that McConnell set a standard that no one else has come close to matching. Code Complete, 2nd Edition will finally displace Code Complete from the shelves and will become a standard until, I suspect, McConnell writes a third edition sometime in the next decade.
Code Complete achieves its victory on the basis of two dimensions: its scope is vast yet precisely delimited and its advice is bold yet supported by data. Compare it to the other two great software development books of the 90s and the early contenders for this decade’s most influential: Peopleware, Design Patterns, Extreme Programming Explained, and Refactoring. All excellent books, but only Peopleware integrates studies into the discussion as ably as Code Complete and is (appropriately) a much “softer” text. Throw in UML Distilled and a language-specific reference and you’ve got the gift bag I’d give to new programmers. (After which, I’d explain why we wouldn’t be using XP .)
Code Complete is about code construction, the “central activity in software development.” It is not about C++ or Java or Visual Basic programming, although its examples are in those languages (a good evolution from the first edition, which featured C and Pascal). Rather, it fills its 862 pages before the end-matter with a comprehensive treatment of the shared concerns of mainstream languages. Code Complete does not cover the construction of code in non-imperative languages, but is appropriate for any language with a heritage in Algol, C, or Pascal.
In the early 90s, focusing on code construction was radical. At the time, concerned software developers were struggling to define an ethic more sophisticated than the so-called “hacker ethic” that emphasized performance and exploitation of limited resources above all else. As part of that movement, which eventually matured into today’s laudable emphasis on rapidly delivering customer value, “mere” programming was considered an unfit subject. At Computer Language magazine I declared that we would no longer speak of “programming” and “programmers” but rather of “software development” and “developers” (a fiat which culminated in the relaunch of that magazine as Software Development). The first edition of Code Complete shattered the illusion that lines of code stood in contrast to a sophisticated discussion of quality, productivity, and best practices.
Now, of course, the pendulum has swung to the other extreme and what makes Code Complete, 2nd Edition is not its position that “code construction is important” but its position that code construction is the central but not exclusive activity of developing high-quality software. The discussions in Code Complete, 2nd Edition that I most want to resonate the industry are no longer those from the core chapters on comments and pseudo-code and how to name your variables and so forth (as eager as I am that such discussions find a new generation of readers) but rather the discussions on how metaphors, personal character, and attitudes towards craftsmanship are complemented by a growing body of knowledge about best practices. I think it’s premature to use the term “software engineering,” for even the most-disciplined approaches to development, but the time has clearly come for our industry to move beyond anecdotes of what works and what doesn’t. Code Complete, 2nd Edition is a clarion call: accessible to any programmer and yet not faddish, pragmatic advice on constructing your next line of code and yet bolstered by hundreds if not thousands of references.
Code Complete, 2nd Edition’s approach to object-orientation is probably the aspect that will garner the most critique. The rise of object-orientation in the early- to mid-90s was epochal: today’s well-written code differs significantly in structure from well-written code circa 1990. For those of us in an older generation, these differences in structure often seem primary: combining data and behavior in a module, replacing conditionals with polymorphism, reducing visibility. Code Complete, 2nd Edition does not share this emphasis in its discussion. Rather, object orientation and its effect on code is essentially assumed as a structural theme, as reflected in the names of core sections of the book: “Creating High-Quality Code” is followed by sections named “Variables,” and “Statements,” tellingly replacing the original sections “Design,” “Data,” and “Control.”
McConnell implicitly rejects the fear that object-orientation needs to be continually highlighted lest the reader fall into lazy habits. For instance, McConnell’s chapter on conditionals has a cross-reference to, but does not explicitly highlight, the use of polymorphism as an alternative to a case statement and his section on “Taming deep nesting” gives “Use a more object-oriented approach” and “Redesign deeply nested code” as alternative, not fundamentally correct, answers.
Pedagogical quibbles aside, Code Complete 2nd Edition deserves to be the most read software development book of the year, a distinction which it almost undoubtedly will achieve. Buy it now, because it’s going to change the conversation.