Wednesday, August 26, 2009

Bug-fixing code reading

To recap:
  • I've been digging into a new body of code
  • I started by reading through lots of the code in my editor
  • Then I started setting up some scenarios and stepping through them in my debugger
  • Then I tried to explain how things work, to a (bored, but kind) colleague or two
What's the next step? It's time to fix a bug!

This is a point where a little bit of luck can come in handy, because you don't want to pick the wrong bug. You want to pick a bug which is challenging enough to make you have to exercise some of the knowledge and mental models that you've been developing, but not so hard that you get stuck, and discouraged, and annoyed.

So if you happen to have somebody around who can suggest a good bug, that's great. Otherwise, you'll just have to take your best guess from the bugs that are known.

Update the bug-tracking system to indicate that you're working on the bug, and get to work:
  • Ensure that you can reproduce the bug
  • If the bug-tracking system doesn't already contain an automated test case for the bug, write one
  • See if you can modify the code, to make the test pass
  • If you can, run all the other tests, to see if your change had any other (observable) effects

No comments:

Post a Comment