Modern C++ Design - Andrei Alexandrescu

A classic. Just not necessarily in a good way. This is, indeed, the epitome of modern C++ design, and pretty much all that's wrong with it. You know the cartoons where the character tries to dig out of jail with a tea-spoon? Well, it's like that. Except that they realised it wasn't working well, so they engineered themselves a 6 foot sterling silver tea spoon. Rubbish metaphor? Yes, but I'm trying to get across the insanity of this book.

So, C++. You take C. You add objects. You watch it get popular. You let everyone add their favourite toys as it goes through standardisation. There follows a mad Darwinian scramble to define what 'good' C++ is. The result is a distribution from 'writing C with C++ style comments', through the consensus style of Sutter and the less freaky parts of Boost, through to... this. 'This' means finding a) not all the kitchen sinks you want are in the language and b) finding that by carefully abusing those that are in the language, you can emulate many of the missing parts, as long as you have a strong stomach. This book is full of clever, freaky hacks and design tricks, mostly centred around templates, and manic misinterpretations of Design Patterns. And 'clever' is the fire to the C++ community's moth-like nature, so expect to see more of this stuff.

So, yes, it does look like I'm massively bitter, and I'm going to use this review as a platform for ranting. So, what's so wrong about applying clever tricks to give you what you want in C++? Well, if you want to get there, you don't want to start here. The way C++ is going, they've chosen one of the most stupid possible start points. They're reinventing functional programming, badly. And in such a non-academic manner. There's this whole parellel pseudo-academia going on in C++-land where they write articles and magazines and stuff, but never referencing real academic work (try looking at this book's bibliography). Which is a shame, since real academia has generally been there, done that for most of the problems being encountered in C++. Of course, they don't encounter exactly the same problems, since they tend to work on abstract clean problems, rather than the insane artifical restrictions of fitting things into C++. Those things that haven't been approached in the academic community? Well, C++ users just hack at them with no regard for how they fit into the wider context.

So, all-in-all, this is a myopically C++ specific book. It must be said that some of the tricks and designs involved are breathtaking, but in a way that rather reminds me of Samuel Johnson's quote about a dog dancing on its hind legs.

Posted 2006-09-10.