Modern C++ Design

That was in 2007, I was a bit frustrated with the Design Patterns book and was looking for more concrete examples. Design Patterns, from Gamma et al.,  is a great book, but required more experience than what I had at that time to get the proper understanding on when to use a given pattern.

So, there I was, I did a Google search looking for more concrete examples, ended up on this book: “Modern C++ Design, Generic Programming and Design Patterns Applied” by A. Alexandrescu, read some good reviews and ordered it.

When it came a few weeks later, that was quite a blow. Before reading this book, I never really understand how it was possible to do research in computer language, I was seeing more than a tool that you use to do something else without realizing that so much was going into the design of the tool itself and the craft necessary to use it fully.

What is great with this book is that it starts from a simple problem, let’s say Compile time assertion and guide you progressively through several solutions from the simplest to the perfect one explaining on the way the shortcoming of each solution. This is a great way to learn and the second chapter, Techniques, is particularly valuable in this regard.

The separation between compile time processing (with the templates) and execution time processing is very well exposed and is mandatory when trying to design new stuff for a library that is mixing static and dynamic polymorphism.

The concept of typelist was totally new for me and seemed like it was an exercise were you try to go as far as you can with the tool you have. This is close to was is done in mathematics. Unfortunately, I haven’t had an opportunity to see it  (or to put it) in action yet.

Besides the fact that the book is very well written, it propose a real implementation for some of the pattern concepts which help understand how they work. It also exposes several original usage of some C++ features. Of course, this is not the first book to do that, but… that was the first for me.

Leave a Reply

Your email address will not be published. Required fields are marked *