Thursday

How to debug errors



There seems to often be confusion among developers when they encounter an error in the software or script they are working with. I've compiled a simple process for debugging without wasting lots of time (both yours and others')

  1. Look at the first error and fix it. 
  2. No really, don't consider all the warnings and other errors unless they can illuminate why that first error occurred. Once there is an error, all bets are off for the rest of the code/script/whatever. 
  3. Seriously though: You tendency is going to be to look for something familiar that think you (or you think a coworker) can fix. You're going to try to fix the easy problem instead of the real problem and waste a bunch of time. Errors and warnings cannot go back in time, so the first one almost certainly was not caused by the later ones. 
  4. After trying to fix the first one, you may discover reliable information about why that error can be ignored. Don't ignore it without a good reason or you are just wasting time. 
  5. Don't fixate for too long. Seek someone else's perspective. Explain the problem to a ruber duck
  6. After you've fixed the first error, run the code again and return to step 1. 
When asking others for help with your debugging, always be sure to include all the information, especially the first error. Don't assume that you know what is relevant and waste other people's time (and your own.)