It’s been a long time since I last looked at Test-Driven Development, or TDD. It has been years since I first read about it, and since then I learned about C++ frameworks, but I’ve never used it. It always seemed like a great idea, but optional. Agile or extreme programming sounded cool, but without paired programming, what is a lone indie to do? I had written about Agile individuals years ago, but I lost interest in finding the answers.
Not anymore. I had the chance to see Robert Martin of Object Mentor give a few talks about clean code and TDD, and he made quite the impression on me. He said that software developers give off an air of being unprofessional, but there are things professional programmers do, and TDD is one of them.
Writing tests is one of the practices in Agile development and extreme programming, and the benefits of writing tests are demonstrable. Besides allowing you to have reasonable confidence in the quality of your code, it can actually help drive the design of it, too. I want to emphasize this point since I apparently missed it years ago when I first read it. The design of your code, the actual decisions you make regarding when and when not to use a class, an interface, or a virtual function, gets shaped by your tests! I’ve read more than a few articles in which the author claimed that TDD’s effect on the design was the most important benefit.
That said, aside from High Moon Studios, you don’t hear too much about game developers making use of TDD. If business software developers are seen as unprofessional, what do game developers in general come off as?
I’ve been rereading Noel Llopis’ articles on Test-Driven Development, and I recently downloaded UnitTest++, which is a C++ unit testing framework. I joined the mailing list, which shows that a few other studios are making use of it. Still, I would love to hear more about game developers who have used TDD and other professional developer practices. EDIT: Oh, there is Agile Game Development. A game tends to change towards the end of the project, and having tests ensuring that everything is still working when you make those changes seems desirable. Quicker iterations, better code quality, ease of refactoring, and better code designs should help wrestle those multi-year projects down to manageable levels.
[tags] unit tests, tdd, game development, agile [/tags]