Where did that bug come from?

This is the second time this week that I encountered a annoying bug, introduced just by a small change in the code. Just when you think you can get away with minor changes without testing, you are in for a surprise.

The most common sense thing you can do is to test your code even for small changes; whether you are testing it yourself or sending it to the testing team. Seems simple, but how many times have you really done that. Its not that we are stupid, rather software was never so simple. Maybe we are careless sometimes. The moral is plain – treat even small changes important, and move it through a test before committing it to a version control.

The following figure from Steve Mcconnell’s Code Complete shows the relation between lines of code changed and errors introduced.

bug_source

One thought on “Where did that bug come from?

  1. I find I write mostly bug-free code when I use test-driven development. I don’t know if it’s because of the tests that catch them, or because I pay more attention to detail because I know the tests will fail if there’s a problem, but I think it’s a really good methodology.

    ps. your comment form tab-ordering is wonky. Hitting tab in this comment box jumps to the search box, not to the spam protection box under this.

Comments are closed.