Thursday, September 20, 2007

The Scientific Method of Programming

The scientific method is a body of techniques for investigating phenomena, acquiring new knowledge, or correcting and integrating previous knowledge. The emphasis of the method has always been on seeking truth! The method consists of a series of steps that will show that what we believe to be true is actually true. The steps are shown below:

  1. Define the question.
  2. Gather information and resources (observe).
  3. Form hypothesis.
  4. Perform experiment and collect data.
  5. Analyze data.
  6. Interpret data and draw conclusions that serve as a starting point for new hypotheses.
  7. Publish results.
  8. Retest (frequently done by other scientists).
So how does this relate to programming?
  1. Identify the need.
  2. Identify the task, talk to information holders, disect the problem.
  3. Set up assertions and tests.
  4. Write the code and run the tests.
  5. Validate the tests.
  6. Did the tests pass? Where the assertions correct? If not, correct it.
  7. Publish results (frequently done by Cruise Control).
  8. Retest (frequently done by Cruise Control).
The scientific method of programming is known by another name. It is Test Driven Development or TDD for short.

1 comment:

  1. I think it is pedantically Test Driven Development :-)

    (stupid blogger not letting me underline the n?!)

    ReplyDelete