Incremental Test Driven Development is fine for brand new code... but how does one get started with a code base that doesn't have a regression suite? The traditional approach is to start making changes while doing your best to avoid unintentional collateral damage. Unfortunately, because the code is unfamiliar, you aren't sure what's really going to happen when you change a data structure or update a variable. This leads to interesting kluges when developers re-invent the wheel rather than refactoring code not supported by unit tests, bloating the code and making it still harder to maintain.
How does one avoid these pitfalls of working with existing code? Jared Richardson, author of ShipIt!, says in this exclusive InfoQ arcticle:
"Rather than wandering into this minefield blindly, let's create a plan of attack. Don't just start making changes and hope that everything still works. Instead, take aim and hit it out of the park with a 'BAT': Build, Automate, and Test. ...In addition to this article on testing legacy code, Jared has made a sample chapter of Ship It! available for InfoQ readers.
The BAT approach will ensure that your code continues to work the way you want it to work. It quickly catches unintended side effects and helps you to eliminate them."