What do scientists do

From Wikipedia:

Four essential elements of the scientific method are iterations, recursions, interleavings, or orderings of the following:

  1. Characterizations (observations, definitions, and measurements of the subject of inquiry)
  2. Hypotheses (theoretical, hypothetical explanations of observations and measurements of the subject)
  3. Predictions (reasoning including logical deduction from the hypothesis or theory)
  4. Experiments (tests of all of the above)

Scientists do this about reality.

What is debugging

From my personal experience and Wikipedia, while debugging your own program:

  1. Reproduce the problem (observe it)
  2. Distill the minimal input (hypothesize and eliminate extragenous factors)
  3. Track down the origin (predict results of the fix)
  4. Test to see if the fix works (experiment)

Program is like a complete universe. That universe becomes unknown if it is someone else’s code.

This is exactly what scientists are up to!

Programmers and scientists

I have met programmers, like lemmih, who can just guess how a program works by thinking how he would have designed it. And, gosh, is he usually right.

I wonder if that is how good scientists do it.

I have this inkling that this analogy goes deeper still. If you’ve ever taken part in a programming contest, then you know that you have to be very careful about what test cases you try out before you submit your program lest you should incur a penalty for an incorrect submission. I think that sort of testing also makes you a better rationalist in general by forcing you to think a bit more about the 2,4,6 problem.