Sunday, 26 January 2014

Book review: Boost C++ Application Development Cookbook

Although I write a lot about Clojure, I use C++ and Boost for the majority of my work. As such, when Packt offered me a review copy of Boost C++ Application Development Cookbook (sample chapter), I gladly took them up on the offer.

About the book

As you may infer from the word ‘cookbook’ in the title, this is not a comprehensive Boost reference or a book you expect to read from cover to cover. It consists of scores of recipes, all of which follow the same formula:

  1. An introduction the problem to solve.
  2. A brief statement of the prerequisite knowledge for the solution.
  3. A step-by-step walkthrough on how to solve the problem.
  4. A brief explanation as to how/why the solution works.
  5. Discussion about comparable/related functionality in C++11 or in other parts of Boost.
  6. Pointers to related recipes, external resources, and related Boost documentation.

These recipes are all grouped together into chapters, with each chapter having a general topic such as resource management or multithreading.

The intended audience for this book is experienced C++ developers who may not be familiar with all of Boost’s functionality and how compares with C++11.


There are a lot things that I like about this book, in particular its emphasis on C++11 and the way it introduces a topic and then gives you to resources for more in-depth learning.

Though it’s been out for a couple years now, C++11 is still a relatively new standard and it takes time for programmers and programs to adopt it. Many of the new library features in C++11 are based on Boost libraries, and some Boost libraries exists to help ‘backport’ new language features to older versions of C++. The Cookbook does a very good job of letting the reader know whether C++11 has the same or similar features as Boost and how they differ.

The other thing I really enjoyed about this book is how it gently introduces the reader to Boost. There are a lot of Boost libraries, and the quality of the official documentation varies from very good to cryptic. In the past, I have avoided some libraries simply because I could never figure out how to even get started using them. This book can make some of these more accessible by giving me a simple example from which I can get a toehold. From that point, I can start to make sense of the documentation.

Room for improvement

No book is perfect, and there are a couple of ways in which this book could be more useful:

  1. It is not exhaustive. Granted, the number of Boost libraries is enormous, and some of them have limited applicability. Fortunately, the Cookbook does a good job of covering the most useful libraries.
  2. It only barely touches on the situation when you have to do deal with different Boost versions. Some Boost libraries have source and ABI incompatibilities between versions, and it can sometimes be a bit of a nightmare to write code that has to support different versions of Boost. It would have been nice to see if the author had any insights on how to handle that issue.

Concluding thoughts

Boost C++ Application Development Cookbook is definitely worth considering if you are a C++ developer that uses or would like to use Boost. It’s a good reference to have handy when you find yourself in a situation where you think: 'There has got to be a library for this.’