Test Driven Development
So I’ve changed jobs after working for nine years at my old company. I couldn’t take the travel any more. It was interesting for a season, but that season has passed. I was very appreciative of being exposed to so many different aspects of running a software business.
Now I am working for a much larger company and it is very interesting to compare the experiences. One of the big differences for me is that previously I followed no formal theory of software design. I suppose my approach was something like: capture requirements, develop rough design, identify risks, develop proof-of-concept code for the hard parts, refine rough design, code components, unit test components, integrate components, test system, document, deploy and fix bugs throughout useful life.
The group I am in now uses agile software development with an emphasis on test driven development. I can’t say TDD really works for me. Although I can see the benefits of automated testing and I think I should have been doing that all along. However, in fairness, the system that I worked the most on was some tire testing equipment. Many of the problems that I had to deal with arose from the integration of the software proper, the PLC program and the realities of a physical machine. Don’t get me wrong, I just haven’t had enough experience with TDD to make a judgment. I guess I will just have to try it for a while and see what happens.
From my past experience, I can see that TDD is definitely not the all-in-one answer to software development. For example, if I have want to implement software protection, a.k.a. interlocks, for some piece of equipment, I cannot write a test and watch it fail before I write my code. People get upset when you destroy sensitive, costly equipment.
Also, you can write a test that exercises every line of code in your module, but still not catch all the bugs. I think TDD can be useful, but you still have to think about what you are doing and what problems are likely to occur in the future. One idea that I have been exploring recently is the concept of defensive design as it relates to software engineering.