Too often developers create "prototype" code that makes it into the codebase without being tested. How does this happen? Maybe a developer is just testing one of many possible solutions and doesn't want to test code that he might throw away (hint: this sounds like a good place for TDD). Another common place I've seen this happen when you're prototyping ideas for a end-user to try out, and you don't even know if they'll like it, so you don't bother with the tests up front. I've seen this latter case happen most frequently when requirements are not well defined and the customer isn't entirely sure what they want.
Regardless of how this code gets in there, once it's part of your production code baseline, it's not prototype code anymore, it's production code. In an ideal world, we'd write all of our tests up front and we'd never have any untested code. While this doesn't always happen, when we do put that untested code in the baseline, be sure to go back and write the tests for it before moving on to the next feature. You and future developers will be glad you did.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment