"Advanced styles and idioms" neither very advanced nor idiomatic

Decade-old classic not for everyone

James O. Coplien: Advanced C++ Programming Styles and Idioms, 1992, Addison Wesley, ISBN 0-201-54855-0, 500 pages
reviewed by Conrad Weisert, December 2001

Although this well-known C++ book had been around for a decade, I've been hesitant to review it, hoping that the author might soon give us an updated version with fewer flaws. Since it's often cited as a reference by respected authors, however, (e.g. Scott Meyers) and I'm often asked about this book by students, clients, and colleagues, I'll wait no longer.

An odd and challenging mixture of levels

A decade ago when object-oriented programming was still a novelty, James O. Coplien's book generated huge interest and considerable controversy among professional programmers. M. Jourdan gave it a rave review in the November, 1992, ACM Computing Reviews. More recent reviews (e.g. on Amazon) have been split between those who consider it an indispensible guide and those who find it some combination of dated, impenetrable, erroneous, and condescending.

All of them are right! After a slow start, perhaps because he wanted to cater to those with limited C++ fluency, Mr. Coplien introduces us to various non-obvious (in 1992) patterns, such as envelope-letter, reference-counting, and function-objects. He goes on to challenge our minds with discussions of more sophisticated techniques that seem to transcend C++ and that most of us will rarely if ever have use for, such as multiple dispatch, and dynamic incremental loading.

It was no doubt the later sections that gave rise to the widespread view that Advanced C++ Programming Styles and Idioms is inaccessible to the typical applications programmer.


While Mr. Coplien's writing is generally clear, some readers find his repeated claim to "The Orthodox Canonical Class Form" awfully pretentious. He was just giving the readers his own recommendations (which actually violate a lot of common-sense good practice, even a decade ago).

Operator troubles: 0 + 0 = 1

Throughout the book, Mr. Coplien has trouble with operator overloading. I noted one particularly weird example involving Complex numbers in an earlier article (a complaint with which Mr. Coplien vigorously disagreed), but that's not all.

In several examples, the author gives us an overloaded + that's neither commutative nor associative. That drives Java zealots nuts, confirming their worst fears about the mis-use of operator overloading. For example:

Redundant shapes

How many integers does it take to specify a rectangle? 16.

Appendix B presents a rectangle class derived from a general Shape base class. The member data items are four Line objects, each of which is defined, as you'd expect, by two points (called "Coordinates"), each of which is defined by two (x, y) coordinates.

My high-school geometry teacher would have been amazed.

The bottom line

Despite the numerous and surprisingly naive gaffes, Advanced C++ Programming Styles and Idioms contains a lot of useful ideas for the experienced and sophisticated professional. I consult my copy from time to time, and look forward to an updated edition.

Recommended only for discerning readers

Return to book reviews.
Return to C++ topics
Return to table of contents.

Last modified December 2, 2001