Modern C++ Programming with Test-Driven Development: Code Better, Sleep BetterModern C++ Programming with Test-Driven Development: Code Better, Sleep Better by Jeff Langr

My rating: 4 of 5 stars

Dear Readers!

I’m happy to present yet another review of a book, though not on a totally unfamiliar subject this time, as it involves something I have already read about earlier this year. If this book was worth reading after the other one, you can find out in the review below, which is also posted on goodreads along with my other reviews. Please enjoy.

When I was looking for a next book to read, I wanted it to be about unit testing with a focus on test driven development and C++ and without repeating all the things found in an other excellent book, The Art of Unit Testing. After looking around a bit, I stumbled upon this one, and I’m glad I did, as it turned out to be a lot more than I expected. Let’s see it in a bit more detail.

The author starts with some details about the environment to be set up and the various tools and libraries one will need to use to get the uninteresting, yet necessary things out of the way as soon as possible. After that however, he gets down right to business without further ado with a very interesting problem, which is used to demonstrate how test driven development (TDD) can be used to solve it. This is an interesting approach, as there has been no discussion about TDD up until this point, but the author was very careful to make the example easy to follow even to those, who have never hear of any sort of testing before by making each step small and backed up with appropriate discussion. This chapter is also used to guide the reader through his/her first encounter with a unit testing framework, always explaining what does what and why, so no prior knowledge whatsoever is required.

At this point one could of course argue, that this in medias res approach is a bad way to start, but after reading the book, I’m actually convinced that this is the way to go, as the reader already has something real to relate to while going through the rest of the chapters, which include topics about test construction, test doubles, legacy challenges and threading and others. There is no shortage of code examples, which are is easy to follow at the beginning, but unfortunately this ease fades away for a while and then returns only closer to the end of the book. In order to be able to understand the harder to follow sections completely, one needs to download the accompanying code samples, but as of the writing of this review not everything compiles immediately due to some since deprecated features used in the examples. An update to the code base would definitely be nice have at this point, but with a little bit of reading fixing them is not rocket science either.

Apart from the topics mentioned earlier, the reader is also presented with some less technical, but nonetheless useful and important information on incremental design, quality of tests, sustaining TDD and avoiding some common pitfalls, how to actually decide what test to write next, metrics, practice possibilities, pair programming and more. The author also doesn’t miss the opportunity to address some common concerns regarding TDD and the way code is written because of it by presenting quite solid arguments in favor of TDD, which I especially liked. So how can this book be compared to the other one mentioned at the beginning of this review? To be honest, I couldn’t say which one is better, as both of discuss similar topics (though not identical), and there is an overlap between them (though not a 100%) because of it. Is the overlap bothering? Not at all, as the topics are presented in a different fashion, and as such they supplement each other’s gaps pretty well.

With all these in mind, I’m pretty happy with this book, and I would most certainly recommend it even for those who already went through The Art of Unit Testing (or have some experience in TDD), and especially for those who have never read anything on the subject. It not only contains essential knowledge about TDD, but offers a lot more which will definitely broaden the view of the reader, but because of some minor caveats here and there I can’t it maximal rating, although I was really thinking about it.

View all my reviews