I was recently introduced to a concept that has been around for a long time.
Test Driven Design strives for 100% test coverage for every line of code written. At a first glance this seems really expensive, but after reading “The Clean Coder” by Robert Martin, I find myself leaning in that direction.
Robert refers to himself as “Uncle Bob” and has a number of very strange videos that explain his approach to software design. His approach encourages designers to write tests first, code second and optimize third. He explains that software professionals have a responsibility to make sure that every line of code they produce has zero defects. Uncle Bob’s suggests that we all adopt a portion of the hippocratic oath, “Do no harm”. He explains that having a complete suite of tests keeps code alive because designers can do an instant verification cycle after each code change. This catches bugs early in the cycle and makes designers unafraid to make changes in code that they may not know all that well.
Uncle Bob explains that the up front investment is going to cost something, but not as much as we might think. The downstream value however, more than justifies the investment. Code estimates will go down with time instead of the more common increase to compensate for unexpected side effects.
As a software designer, I found myself saying “Yes” out loud a few too many times as I read. I would love to work on a code base that had 100% test coverage and I would feel much better about myself knowing that my code had zero defects. I think we all want to do the best possible job and taking pride in what we do makes us feel good about ourselves. Feeling good, makes going to work more enjoyable and that has benefits for us and our employers.
I only had to read the situations described in the first chapter to be hooked. I highly recommend this book as a must read for all software professionals. For those of us who have been around the block, it provides new perspectives on situations that we have already experienced.