Test Driven Development Is The Only Way To Go
Ben Widsten NCR, Embedded Systems Firmware Developer https://ca.linkedin.com/in/ben-widsten-1089656 2016-08-25 |
Our firmware team develops embedded software for Automated Teller Machines written in C. Our team was first introduced to Test Driven Development in May 2014 when James came to our office for his one week TDD course. The concepts were very strange and foreign and quite often he suggested we should do things exactly opposite as we were. Towards the end of the course though, it began to click. As soon as we got back to work after the training, our code started to get better – slowly but surely. Most of our existing code wasn't testable in its original state. But with the new knowledge of what testable code looks like, we started making incremental improvements towards testability while doing bug fixes and adding small features. Eventually we started adding new features to legacy code (code without tests) using TDD.
Seeing the value in having code under test, we began reworking the most important legacy modules to get them under test. In doing so, we started to see our legacy code in a very different light. The biggest surprise was the amount of duplicated functionality (that had existed for years). It became obvious when the tests for unrelated modules were eerily similar. Not wanting to waste time writing duplicate tests, objects were born. These objects (a notification queue for example) were written once using TDD but used by many other modules. In the first few months, we removed thousands of lines of production code while keeping the same (or better) functionally and the code became modular, easier to read and maintain and of course, testable.
We’ve been practicing TDD for a few years now and have reached the point where all new code is developed using TDD. Our code is continuously improving but at the same time, the team’s approach to software development is improving too. We now do daily stand up meetings, pair programing, code reviews and are continually honing coding best practices specific to our team. Another interesting side effect is the new found freedom to effectively develop embedded software away from our desks (and hardware); in a meeting room, at home or on the road. We recently replaced our desktop development PCs with laptops and we even tore down our cubicle walls to improve communication between developers.
TDD has not been without it's learning curve. It simply takes experience to write good tests and know what can and can't be tested with TDD. We've had some ups and downs but are fully committed to TDD. We can respond faster and more confidently to bug fixes and requirements changes. We have shown that fewer defects reach our test lab reducing the number of manual test iterations and ultimately, fewer defects reach our customers.
James was very helpful during our training and continues to be long after. I highly recommend his training for anyone looking to improve their embedded software.
Ben
PS Our next step in continuous improvement is a continuous integration build sever.
Tweet
All Stories
We invite you to submit your own story about TDD or Agile for Embedded System Development.
Latest News
Conference Video - Deep Stack – Tracer Bullets from ADC to Browser
A blank page can be very intimidating, even for a Test-driven developer. Where do we start? Write a test, right? Not always.
more...Podcast on Agile Amped
Here is a short interview with James about TDD and embedded software from the deliver:Agile conference last spring.
more...Programming Research -- Please Participate
Do you have some time to do a simple programming problem in C or C++ for my research?
more...Clean Coders IoT Case Study
My long-time good friend (Uncle) Bob Martin and I have fun programming together firing tracer bullets for distributed water pressure measurement system.
more...Books
James is the author of Test-Driven Development for Embedded C.
Have you read Test-Driven Development for Embedded C? Please write a review at
Amazon
or
Good Reads
.