(Book Review) Test-Driven Development for Embedded C By: James W.Grenning
So, what if you write a code that you are more confident about, has less bugs and development time is actually faster. Sounds too good to be true? Or Dose it make sense? In this review, we take a close look at the book called “Test-Driven Development for Embedded C” by James W.Grenning and see if they are possible.
In old fashion software development routine, we tend to write a part of code, then start testing and finding the bugs. That would not be pleasant experience especially when the bugs shown up and we were shaking our heads about where to start digging from.
In TDD, on the other hand, test cases are driving your software development. When developing a function (unit of a code), you start by writing a small test to fail, then you write a simplest code to pass the test, then you will refactor the code. Next, you do the loop again, write another test, write the code to pass the test, refactor, Test, Code, Refactor. You will do the loop until you finished developing a particular function.
The good side would be that, you now know that your code is actually working and backed with set of tests to keep you more confident, you debug the problems along the way and if you modify the code later on, you run the tests again to make sure that you didn’t break anything.
Well, wait a minute…
You may think that, writing a test cases alongside the code will actually increases the development time...
You may be right, but you are not considering the amount of time you are debugging after development. In practice, you end up saving more time down the road using TDD with much less headache from this annoying bugs. I recommend giving the TDD a try before jumping to any conclusion.
James W.Grenning, with this book, has brought the Test-Driven Development to Embedded Software development and made it easier for them to use it. In this book, author will get you through the TTD, from the basic, to the more advance level about “mocks” and so on. The book addresses framework for both C and C++, so you are covered by your language of preference.
The book has a good beginning, is fairly easy to read and getting to up and running is pretty much straight forward by following the book. But, second half of the book is a bit hard and boring to follow. Mainly because the concepts are suddenly advanced, and you may not need them at the time of reading and also is not as easy to read as first half.
I recommend reading the first half the book, alongside the coding practices. And have the quick look on another half. If, at any time, you need one of the advance topics, you can pick up the chapter and read. Speaking about coding, the book comes with many examples and coding practices, so in that sense, you are good to go.
Regarding the TDD for Embedded, There are also some online courses as well, make sure to check them to speed up your learning. But, the book is still better to be on your bookshelf, because it provides a complete reference of TDD for Embedded Software Developers.
The author is a known expert regarding Agile and embedded software development. Therefore, you will learn the topic from an experienced specialist. You will not be chasing the bugs anymore and will get immediate feedback by the changes that you will do in your code, plus you get to save some time along the way.
I put the book in Good-To-Have categories and that is only because peoples have different coding style, but still I highly recommended it to every embedded software developers who cares about the software quality and reliability. There are techniques in the book that if you master, would help you a lot in your career.
The book ("Test-Driven Development for Embedded C") on Amazon:
Amazon US: http://amzn.to/2rGSPUI
Amazon UK: http://amzn.to/2DEM5rN
Hope you find this article helpful. As always, remember asking better questions, will help you to find better answers.
If you find this article useful, share it so that your friends can also benefit. It would be pleasure to have you as a subscriber, so make sure to subscribe to the newsletter to stay on top my featured blog posts and book recommendations each month.