.NET Zone is brought to you in partnership with:

Dror Helper is an experienced software developer has written and designed software in various fields including video streaming, eCommerce, performance optimization and unit testing tools. He is passionate about programming best practices and all things software development, and has been a guest presenter at several user group meetings and ALT.NET events. Dror's blog can be found at http://blog.drorhelper.com where he writes about unit testing, agile methodologies, development tools, programming languages and anything else he finds interesting. Dror is a DZone MVB and is not an employee of DZone and has posted 57 posts at DZone. You can read more from them at their website. View Full User Profile

Book Review: Modern C++ Programming with Test-Driven Development

03.12.2014
| 3143 views |
  • submit to reddit

I’m always looking for ways to learn more about unit testing and TDD, I was elbow deep in a C++ project and I was looking to learn more about the tools & tricks of TDD in the unforgiving C++ world when this book was published and so I’ve started reading it.


This book does two things which I believed to be impossible (or really, really hard) - teach TDD without first explaining about unit testing by using C++.

Don’t be fooled by the title this is not a C++ book, but rather a very good book about TDD – the tooling, how to write a unit test, how to think the TDD way, legacy code – you name it.

After the first chapter which handles the logistic of compiling and setting the development environment (it’s still C++) the book really starts with a good example - easy to understand but not trivial and shows how using TDD and Google Testing framework you can create an emerging design.

The book covers everything I expected from a good unit testing book and more. Other than the obvious red-green-refactor, unit testing (and mocking) frameworks and how to structure a good unit test, there is much more - great topics which could save time and frustration to anyone who practice TDD: there’s a chapter about how to introduce TDD to your peers and supervisors (non techies), a chapter about the Mikado method, a chapter about unit testing and multi-threading and a chapter about creating a sustainable TDD suite – which anyone who failed implementing TDD can really appreciate.

I do not agree with everything in the book – for example I try to avoid using Setup/teardown methods because I’ve seen the horrors that they can become if not managed correctly and I have some thoughts about the ways that some of the tests are structured in the book – but I was relived to find out that this book while teaching on way to write unit tests does not advertise it as the only way and say so towards the last chapter.

I highly recommend this book to anyone who want to learn TDD or improve the way tests are written and designed - not just C++ developers.

So pick up this book and perhaps you can also “Code Better, Sleep Better” or at least understand TDD much better…

Published at DZone with permission of Dror Helper, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)