Computing Reviews
Today's Issue Hot Topics Search Browse Recommended My Account Log In
Review Help
Search
C++ coding standards : 101 rules, guidelines, and best practices (C++ in Depth Series)
Sutter H., Alexandrescu A., Addison-Wesley Professional, 2004. Type: Book (9780321113580)
Date Reviewed: Mar 7 2005

I have worked at a number of companies, and, as a team leader, one of my first tasks is to ensure that there is either a coding standard, or that the existing C++ coding standard is up to date and reflects current C++ practices. The most recent time this happened was about six months ago. I then became aware that Sutter and Alexandrescu were writing a book on C++ coding standards, and decided to wait and see how useful the book would be in setting up our own coding standard.

I am pleased to say that this book has almost made the need for a company to have its own coding standard obsolete. The book gathers together 101 best practices, and presents them in a form that makes them easy to implement as a coding standard. Of course, if the book was just a coding standard, it would not be as useful as it is. The work is a lot more than a set of standards or guidelines; each item has about a page-and-a-half of annotation. The annotations all follow the same format. First, there is the guideline; for example, item 73 is “Throw by value, catch by reference.” There is then a one-paragraph summary of the rule. This is followed by a more comprehensive discussion. The discussion is followed by examples, exceptions, and references.

For readers who are familiar with Scott Meyers [1,2], there is a strong similarity between his work and the way that good C++ coding practices have been encapsulated into these sound bites; each of them is sensible, and most of them teach something new about the C++ language. You get the feeling when reading these that they are the product of years of experience, by people who have had a lot of exposure to C++.

The book starts off with this advice: “Don’t sweat the small stuff.” In other words, don’t get too caught up worrying about things like indentation, or whether the bracket starts on the same line as the “if” statement or the next line. The authors follow their own advice, and concentrate on issues that have engineering outcomes. I personally think this is a plus, but I imagine that there will be some managers who would like to adopt a book like this as a standard for code reviews, and who will not like the fact that the book has left out issues such as brace placement.

The book is well organized in the way that it has subdivided its information into groups, such as “Templates and Genericity” and “Error Handling and Exceptions.”

My only criticism of the book is that there are quite a few items that are fairly general statements about good programming practice (for example, avoiding premature optimization), and I would rather have seen that space spent on some more in-depth discussion of some of the less obvious rules.

In conclusion, I think that this book will make a suitable C++ coding standards document for almost any imaginable C++ programming shop. The book would probably also be valuable to a less experienced programmer wanting to learn better C++ programming practice. The more advanced programmer will pick up some good advice, but should already be familiar with many of the topics covered in the book.

Reviewer:  Martin Schweitzer Review #: CR130924 (0512-1290)
1) Meyers, S.; , Effective C++: 50 specific ways to improve your programs and design (2nd ed.). Addison-Wesley Professional, Boston, MA, 1997.
2) Meyers, S. More effective C++: 35 new ways to improve your programs and designs. Addison-Wesley Professional, Boston, MA, 1995.
Bookmark and Share
  Reviewer Selected
 
 
C++ (D.3.2 ... )
 
 
Object-Oriented Programming (D.2.3 ... )
 
 
Object-Oriented Programming (D.1.5 )
 
Would you recommend this review?
yes
no
Other reviews under "C++": Date
A C++ toolkit
Shapiro J., Prentice-Hall, Inc., Upper Saddle River, NJ, 1991. Type: Book (9780131276635)
Dec 1 1991
Borland C++ handbook
Pappas C., William H. I., McGraw-Hill, Inc., New York, NY, 1991. Type: Book (9780078810152)
Feb 1 1993
Going from C to C++
Traister R., Academic Press Prof., Inc., San Diego, CA, 1993. Type: Book (9780126974126)
Apr 1 1994
more...

E-Mail This Printer-Friendly
Send Your Comments
Contact Us
Reproduction in whole or in part without permission is prohibited.   Copyright 1999-2024 ThinkLoud®
Terms of Use
| Privacy Policy