ACCU Home page ACCU Conference Page
Search Contact us ACCU at Flickr ACCU at GitHib ACCU at Google+ ACCU at Facebook ACCU at Linked-in ACCU at Twitter Skip Navigation

Search in Book Reviews

The ACCU passes on review copies of computer books to its members for them to review. The result is a large, high quality collection of book reviews by programmers, for programmers. Currently there are 1918 reviews in the database and more every month.
Search is a simple string search in either book title or book author. The full text search is a search of the text of the review.
    View all alphabetically
Title:
Modern C++ Design
Author:
Andrei Alexandrescu
ISBN:
0 201 70431 5
Publisher:
Addison-Wesley
Pages:
352pp
Price:
Reviewer:
Francis Glassborow
Subject:
advanced c++
Appeared in:
13-1
As some readers know, I try to grab a high proportion of the truly awful books so as not to burden others with the task of trying to be honest though kind. As you can guess, I also get first pick of the really good ones, or at least the ones I think will be good. I particularly look out for books that either set a new standard of excellence in an existing category or that open up an entirely new area. Books likeAccelerated C++fit the first category and those such asGenerative Programmingfit the second. This book is very definitely in the second category.

Let me first get my biggest criticism out of the way. The title is deeply misleading, probably a candidate for most misleading title of the year. The subtitle,Generic Programming and Design Patterns Appliedis much better. The book should have been given a title such asModern C++ Template Techniques.

Next let me comment on the quality of Andrei's English. It would be hard to guess that Andrei is not a native English speaker (he is an expatriate Rumanian). The quality of his technical writing sets standards that many others might aspire to. Every now and again his English shows that he is not a native speaker. Sometimes his (lack of) use of the definite and indefinite articles has crept past the copy editor actually many publishers cut costs on this element of preparing a book for publication.

Regular followers of comp.lang.c++.moderated (and if books like this one interest you, you should be reading that newsgroup) will be familiar with Andrei's insightful contributions. This book is the distillation of many of the ideas he has placed before us over the last couple of years. The first part of the book consists of four chapters that introduce various template techniques. In the first chapter he shows how templates can be used to support policy-based design. This is a design mechanism that should certainly be in the repertoire of any competent programmer.

In the next chapter he introduces half a dozen techniques such as using templates for compile time assertions, type to type mapping, type traits etc.

Chapter 3 introduces one of the really remarkable template mechanisms that Andrei has developed. The core of this idea is:

template class<class T, class U>
struct Typelist
{
 typedef T Head;
 typedef U Tail;
};
The rest of the chapter expands on how to make best use of this idea. One warning I should give you is that you will need a compiler that supportstemplate templateparameters like, for example, that in the following declaration:

Template<class Tlist, template<class> class Unit>
Class GenScatterHierarchy;
This is bleeding edge technology, but if you want to understand why such things are in C++ books like this one may persuade you of their utility.

Chapter 4 develops a special allocator for small objects, which will remove much of the pain when you are developing an application that relies heavily on the dynamically allocated small objects.

The second part of the book concerns components. The chapter titles are:

Generalized Functors,

Implementing Singletons,

Smart Pointers,

Object Factories,

Abstract Factory,

Visitor

Multimethods
.

By the time you have finished reading and thinking about this material you will wonder why you ever doubted the power of C++ templates. As you read the current hype surrounding C# you will wonder how any C++ programmer would wish to return to the bad old days and forgo the tools that template technology offer.

If you want to sample a single chapter, have a look at the one on smart pointers which will demonstrate the power of the policy based templates from chapter 1.

If you think I am wildly in favour of this

book, you would be dead right. This is not a book for novices but if you are serious about

your programming and count C++ in your programming tools then you owe it to yourself to get this book and study it. It isn't just the explicit contents that matter but the whole approach to using C++. Reading this book will do one of two things, make you a much more skilful C++ programmer or persuade you that you still have far to go to become a master of C++. Perhaps both.

The final icing on the cake is that the ideas incorporated in this book are encapsulated in the author's Loki library that is available free on the Internet.

Those that come toThe ACCU Spring Conference 2001http://www.accu.org/events/public/accu0103.htmwill get a chance to meet the author in person. Personally I think that is just one of half a dozen reasons that you should come to that event.