Thursday, June 3, 2010

Follow your debugging process, stupid. In 10 easy steps.

This post is a reminder to myself. I wasted a lot of my personal time and time from members of my team by not following, a simple, repeatable debugging process. The below process won't work 100% of the time, but when it does it will save you hours, stomach lining and and leave you extra gas in the tank for handling problems that are actually hard to replicate and debug.

  1. Verify the input and output creating the defect.
  2. Replicate the defect in your development environment.
  3. Write a unit test that replicates the defect using the same input as the defect and desired output. (You may want to extend this to other permutations of the defect as well.)
  4. Verify the unit test breaks.
  5. Fix the code.
  6. Verify the unit test passes.
  7. Verify that the defect is resolved in your local development environment.
  8. Release to next environment (Prod/QA)
  9. Verify that the defect is resolved in the next environment.
  10. Repeat until defect is fixed for all users.
Do not try to skip steps in the process. You will miss something important. You will waste yours or other people's time. It's not worth it.


2 comments:

  1. To me it's really all about Step 1...i mean, if you haven't entirely isolated the input (the output is usually how you know there is a defect), you're just looking for a needle in a haystack.

    If you really want to be efficient, steps 2,4, and 6-10 should be clocked regularly...if it takes you 10 minutes to see if a fix "worked", you're going to waste alot of time no matter how intelligently you approach the problem.

    ReplyDelete
  2. Totally agree on your points, I added them for completeness. I don't have my system setup to upload a content db daily (which I'll do now), we have continuous integration for automating the unit testing and we're working on getting continuous deploy (already have for 2 services) on all of our systems. that way, 6-10 happen automatically on check-in. My initial goal is 20 minutes for full testing. Deploy to prod in < 30 minutes.

    Maybe I'll do a future post on automating testing and deploy.

    ReplyDelete