As we talk about testing, let's take a moment to look back at the seven steps.
Recall that testing is step six, after you have devised your algorithm, and
translated into code.
At this point many programmers, even experienced programmers,
are eager to finish the problem.
Sometimes this eagerness leads programmers to give testing much less emphasis than it
requires, writing only a few test cases and saying their code works.
However, testing code is really important and
should not be give such cursory treatment.
Let's look back to early steps for a second.
In step one, you already worked through instances of the problem by hand,
this means that you came up with the right output for particular inputs.
We could use these inputs and outputs as test cases,
especially as we have worked out the correct answer to compare to.
In fact, if we take this approach we might apply the ideas of black box testing,
coming up with test cases for what we think it would be difficult at step one.
That is, we might think of difficult cases for the problem before even it begin and
use those in step one.
Why would we want to do this?
Not only does it set us up to have a nice set of test cases when we get to step six,
but the earlier we think through these difficult cases,
the less we have to change later.
If we get them all right the first time, that is best.
This idea of writing test cases first,
actually has a name, test driven development and is used in industry.
This process meshes naturally with the seven step method,
as developing those test cases works well for step one.
We will have you use this idea for
some assignments as we progress through this course.
Writing test cases first, then beginning to develop your code.