January 13, 2004

Stupidity, thy name is Coder

Jeremy Zawodny posted an entry extolling the virtues of a sanity check.

I have spent a lot of time learning to start asking stupid questions the moment that things get weird. So here are 10 stupid questions to ask.

  1. Does code that shouldn't compile still compile?

  2. One of my coworkers used to refer to #if 0 statements as ninja operators as they could stealthily assassinate your debugging techniques. A similar effect can be achieved by editing files that you had backed up instead of your real files.
  3. Does code that should crash still run?

  4. Sometimes I use printline debugging to assess the general behavior of a program and I accidentally introduce two print statements that are a little too similar. Adding code that should halt the program (either an assert(0) or something like dereferencing a NULL pointer) usually points out that you've done something really wrong.
  5. Did the executable actually compile?

  6. Check that file modification date and the output of your build process. Back in college a friend and I were working on implementing the Boids flocking algorithm and he had chained the compile command to the command to run the program. This worked fine until sometime around 3:45am when we introduced a syntax error and were so intent on the runtime behavior of the program that we totally ignored the fact that the executable wasn't actually compiling. More often this happens due to a permissions problem on the executable.
  7. Are you running the right executable?

  8. One of my first programming problems in college drove me insane because I couldn't get it to work incorrectly no matter what crap I put in the code. It turned out that the sample program provided by the TAs was named exactly the same as my program and was in a path that was listed before the current directory in my PATH variable.
  9. Was it supposed to do that?

  10. Every once in a very long while you'll see a program act in an absolutely obscene (and possibly pathological) manner that you will swear must be absolutely wrong... but it will, in fact, be the correct behavior no matter how much you wish it wasn't.
  11. Is your porn collection too big?

  12. Software doesn't always deal well with running out of disk space.
  13. Did you apply the -15 to-hit modifier for a moving target?

  14. If you have a data set and a piece of software that are both being developed and you don't synchronize between the two of them you are chasing a moving target which may make debugging impossible.
  15. Did you explain the problem to your coworker?

  16. A friend of mine refers this as letting someone else play "Captain Obvious". Apparently someone he went to college with took this roll a bit too seriously and would wear a hat emblazoned with the letter O while doing this. 90% of the time the problem becomes obvious when you explain the situation to your coworker. The other 10% of the time the coworker usually tells you exactly where you are doing something stupid.
  17. Did you demonstrate the problem to someone who can do something about it?

  18. Murphy says the problem will go away just in time to make you look like a total idiot.
  19. Have you considered cosmic rays, wormholes, and the dark side of The Force?

  20. Sometimes things just get messed up inside your computer. Reboot the damn thing. Even if it doesn't fix the problem you often get this flash of insight about what's really wrong just after you realize you're past the point where you could abort the reboot.
Posted by matt at January 13, 2004 03:51 AM
Comments

Good list :) The porn collection actually applied to my roommate this past semester. Pathetically sad, but pathetically true.

Posted by: Chris at January 13, 2004 12:05 PM