Login | Register Construx Home
Code Complete, Second Edition
Chapters: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 28 29 30 31 32 33 34 35

Notes about the Second Edition

When I wrote Code Complete, First Edition, I knew that programmers needed a comprehensive book on software construction. I thought a well-written book could sell twenty to thirty thousand copies. In my wildest fantasies (and my fantasies were pretty wild), I thought sales might approach one hundred thousand copies.

Ten years later, I find that CC1 has sold more than a quarter million copies in English and has been translated into more than a dozen languages. The success of the book has been a pleasant surprise.

Comparing and contrasting the two editions seems like it might produce some insights into the broader world of software development, so here are some thoughts about the second edition in a Q&A format.

Why did you write a second edition? Weren’t the principles in the first edition supposed to be timeless?

I’ve been telling people for years that the principles in the first edition were still 95 percent relevant, even though the cosmetics, such as the specific programming languages used to illustrate the points, had gotten out of date. I knew that the old-fashioned languages used in the examples made the book inaccessible to many readers.

Of course my understanding of software construction had improved and evolved significantly since I published the first edition manuscript in early 1993. After I published CC1 in 1993, I didn’t read it again until early 2003. During that 10 year period, subconsciously I had been thinking that CC1 was evolving as my thinking was evolving, but of course it wasn’t. As I got into detailed work on the second edition, I found that the "cosmetic" problems ran deeper than I had thought. CC1 was essentially a time capsule of programming practices circa 1993. Industry terminology had evolved, programming languages had evolved, my thinking had evolved, but for some reason the words on the page had not.

After working through the second edition, I still think the principles in the first edition were about 95 percent on target. But the book also needed to address new content above and beyond the 95 percent, so the cosmetic work turned out to be more like reconstructive surgery than a simple makeover.

Does the second edition discuss object-oriented programming?

Object-oriented programming was really just creeping into production coding practice when I was writing CC1 in 1989-1993. Since then, OO has been absorbed into mainstream programming practice to such an extent that talking about "OO" these days really amounts just to talking about programming. That change is reflected throughout CC2. The languages used in CC2 are all OO (C++, Java, and Visual Basic). One of the major ways that programming has changed since the early 1990s is that a programmer’s basic thought unit is now the classes, whereas 10 years ago the basic thought unit was individual routines. That change has rippled throughout the book as well.

What about extreme programming and agile development? Do you talk about those approaches?

It’s easiest to answer that question by first saying a bit more about OO. In the early 1990s, OO represented a truly new way of looking at software. As such, I think some time was needed to see how that new approach was going to pan out.

Extreme programming and agile development are unlike OO in that they don’t introduce new practices as much as they shift the emphasis that traditional software engineering used to place on some specific practices. They emphasize practices like frequent releases, refactoring, test-first development, and frequent replanning, and de-emphasize other practices like up-front planning, up-front design, and paper documentation.

CC1 addressed many topics that would be called "agile" today. For example, here’s what I said about planning in the first edition:

"The purpose of planning is to make sure that nobody starves or freezes during the trip; it isn’t to map out each step in advance. The plan is to embrace the unexpected and capitalize on unforeseen opportunities. It’s a good approach to a market characterized by rapidly changing tools, personnel, and standards of excellence."

Much of the agile movement originates from where CC1 left off. For example, here’s what I said about agile approaches in 1993:

"Evolution during development is an issue that hasn’t received much attention in its own right. With the rise of code-centered approaches such as prototyping and evolutionary delivery, it’s likely to receive an increasing amount of attention."

"The word "incremental" has never achieved the designer status of "structured" or "object-oriented," so no one has ever written a book on "incremental software engineering." That’s too bad because the collection of techniques in such a book would be exceptionally potent."

Of course evolutionary and incremental development approaches have become the backbone of agile development.

What size project will benefit from Code Complete, Second Edition?

Both large and small projects will benefit from Code Complete, as will business-systems projects, safety-critical projects, games, scientific and engineering applications--but these different kinds of projects will emphasize different practices. The idea that different practices apply to different kinds of software is one of the least understood ideas in software development. Indeed, it appears not to be understood by many of the people writing software development books. Fortunately, good construction practices have more in common across types of software than do good requirements, architecture, testing, and quality assurance practices. So Code Complete can be more applicable to multiple project types than books on other software development topics could be.

Have there been any improvements in programming in the past 10 years?

Programming tools have advanced by leaps and bounds. The tool that I described as a panacea in 1993 is commonplace today.

Computing power has advanced extraordinarily. In the performance tuning chapters, CC2’s disk access times are comparable to CC1’s in-memory access times, which is a staggering improvement. As computers become more powerful, it makes sense to have the computer do more of the construction work.

CC1’s discussion of non-waterfall lifecycle models was mostly theoretical—the best organizations were using them, but most were using either code and fix or the waterfall model. Now incremental, evolutionary development approaches are in the mainstream. I still see most organizations using code and fix, but at least the organizations that aren’t using code and fix are using something better than the waterfall model.

There has also been an amazing explosion of good software development books. When I wrote the first edition in 1989-1993, I think it was still possible for a motivated software developer to read every significant book in the field. Today I think it would be a challenge even to read every good book on one significant topic like design, requirements, or management. There still aren’t a lot of other good books on construction, though.

Has anything moved backwards?

There are still far more people who talk about good practices than who actually use good practices. I see far too many people using current buzzwords as a cloak for sloppy practices. When the first edition was published, people were claiming, "I don’t have to do requirements or design because I’m using object-oriented programming." That was just an excuse. Most of those people weren’t really doing object-oriented programming—they were hacking, and the results were predictable, and poor. Right now, people are saying "I don’t have to do requirements or design because I’m doing agile development." Again, the results are easy to predict, and poor.

Testing guru Boris Beizer said that his clients ask him, "How can I revolutionize and transform my software development without changing anything except the names and putting some slogans up on the walls?" (Johnson 1994b). Good programmers invest the effort to learn how to use current practices. Not-so-good programmers just learn the buzzwords, and that’s been a software industry constant for a half century.

Which of the first edition’s ideas are you most protective of?

I’m protective of the construction metaphor and the toolbox metaphor. Some writers have criticized the construction metaphor as not being well-suited to software, but most of those writers seem to have simplistic understandings of construction (You can see how I’ve responded to those criticisms in Chapter 2.)

The toolbox metaphor is becoming more critical as software continues to weave itself into every fiber of our lives. Understanding that different tools will work best for different kinds of jobs is critical to not using an axe to cut a stick of butter and not using a butter knife to chop down a tree. It’s silly to hear someone criticize software for being too bureaucratic when they should have chosen a butter knife instead of an axe. Axes are good, and so are butter knives, but you need to know what each is used for. In software, we still see people using practices that are good practices in the right context but that are not well suited for every single task.