Code Complete: The Law

There should be a law, which makes it a duty to every software developer to read this book – Code Complete by Steve McConnell – every two years or so.

Code Complete treats everything that needs to be known by a developer at the code front. This book is very detailed and without any ideology or religion. McConnells only religion seems to be to use hard facts, nothing else.

Facts, Hard Facts

Much of the book is based on hard facts, measurements, science. This is in stark and refreshing contrast to some other famous books for programmers…  which seem to be based more on ideology than anything else.

Some examples of these hard facts.

In chapter 9.1, Considerations in Choosing Good Names, he cites a study that showed that loger names are better for rarely used or global variables and shorter names are better for local or loop variables.

In chapter 18.2, Layout Techniques, he explains, that there have been studies that show:

  • An indentation of two to 4 spaces makes code best understandable.
  • An indentation of 6 spaces is worse.
  • No indentation is the worst for understandability.

In chapter 19.4, Keys to Effective Comments, he mentions a study which found that maintenance programmers most often said that it was most difficult to understand the original programmers intent.

McConnell continues: So, the only two kinds of comments that are acceptable for completed code are intent and summary comments.

Checklists

Every chapter ends with an extensive checklist which summarizes the key points of the chapter. This makes the volume quite useful as a reference on every topic that you might face as a developer.

Summary

I really love this book. I recommend to you: If you haven’t read it already, go, run, fly to get one and enjoy it.

If you read only one book about your prefession in your whole life as a developer, it should be Code Complete.