(From IEEE Software)
Book Reviews
Becoming a More Effective C++ Programmer
John R. Dance
Effective C++: 55 Specific Ways to Improve Your Programs and Designs, 3rd Edition by Scott Meyers, Addison-Wesley, 2005, ISBN 0-321-33487-6, 297 pp., US$44.99.
My initial reaction when I saw that there was a third edition of Effective C++ was “I’ve already read the first edition.” Many people will probably feel the same way, but my advice is to resist that first impulse and pick up the book anyway. This is one tome that deserves to be in every C++ programmer’s library.
The need for a new edition
I read the first edition of Effective C++ soon after it was published in 1991. Every engineer on my project received a copy, and I’ve kept it on my bookshelf as a handy reference since then. The book has become a legend. In fact, other books have been patterned after its style. However, there have been many enhancements to the C++ language and libraries over the past 15 years. Scott Meyers’ new edition captures both old and new. For those of you who have read the first or second editions, some material will be a review, but there is plenty of new information and insights here for you to gain much from this book.
Your very own C++ expert
Effective C++ isn’t a C++ primer or reference. Instead, it helps you practice thinking and expressing yourself in C++. Meyers has a gift, not only for knowing the language’s intricacies but also for explaining them clearly, logically, and thoroughly. Reading the book is like looking over the expert’s shoulder as he codes and listening as he explains his choices, rushing to write notes as he offers advice along the way.
As a simple example, it’s one thing to be able to explain what a pure virtual function is and how it might work, but Meyers goes beyond that and explains the pure virtual function’s purpose. This way, as you design your code, you can determine if a pure virtual function serves your intent.
The book’s topics range from correct constructors, destructors, and assignment operators to templates and generic programming. It moves from an introduction to template metaprogramming to an overview of object-oriented design in C++. Meyers offers advice and tips in a set of 55 specific guidelines, each exploring the important issues and highlighting several points to remember. In general, sentences that begin with “experience has shown” or “when in doubt” are good tips to underline for future reference and use.
A quibble
So, is there anything wrong with this book? Occasionally, it gets a little verbose—I wanted to cut to the chase a few times. Meyers has an easy, conversational style and sometimes says things in clever ways. Once, this got in the way of understanding his point, but this is really just nitpicking compared to the book’s great material.
Meyers introduces the object-oriented design chapter by saying, “If you understand the meanings of C++’s various features, you’ll find that your outlook on [object-oriented programming] changes. Instead of it being an exercise in differentiating between language features, it will become a matter of determining what you want to say about your software system. And once you know what you want to say, the translation into C++ is not terribly demanding.” This sums up one of the book’s greatest contributions. Effective C++ teaches you the meanings and purposes of many C++ features. To become a more effective C++ programmer, read this book and put it into practice.
John R. Dance is a senior principal architect at UIEvolution. Contact him at jdance@uievolution.com.