Friday, February 25, 2005

Software programming can be humbling

My experience has been that software programming can humble the most experienced programmer. You sometimes need a fresh look at the problem at hand and probably fresh eyes as well to debug a problem. Based on my experience, I am trying to come up with a simple set of rules that might help the programmer with his situation, these rules can be generalized so much so that it almost becomes common sense.

  1. Try not too hard to debug a problem, take a break, come back later
  2. Are you able to explain the problem you are seeing? Can you describe the pattern in which it occurs? Stop looking at the code and try to understand the pattern and possible explanation for it
  3. Use your friendly debugger or your friendlier console log messages
  4. Can you narrow down the problem to something simpler
  5. If you are dealing with numbers - think signed != unsigned
  6. Are you dealing with garbage data? Garbage data implies faulty pointers or storing more than the capacity
  7. Do you assert() the code (yourself) frequently enough
  8. Is this a recently created problem - look at what you changed recently
  9. Can you simulate what the computer is doing (if you can find the faulty logic in code) on paper or in your mind. If so, there is a good chance of you catching the bug
  10. Don't solve the same problem twice

I will keep adding to this list as I get more input from all of you or start thinking clearly.
Post a Comment