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