Zusammenfassung der Ressource
How to Write a Program
with the Seven Steps
- Step 1: Work an Example Yourself
- Work at least one
instance of the problem
- Difficulties
- The problem is
ill-specified—it is not clear
what you are supposed to
do
- Lack domain knowledge—the
knowledge of the particular field or
discipline the problem deals with
- Step 2: Write Down What You Just Did
- Think about what you did to
solve the problem, and write down the
steps to solve that particular instance
- Difficulties
- The difficult is thinking about
exactly what you did to
accomplish the problem
- Don´t forget small details, "easy"
steps, or things that you do
implicitly
- Step 3: Generalize Your Steps
- Find the pattern that allows us to solve the whole class
- Take particular values
that we used and replace
them with mathematical
expressions of the
parameters
- Find repetition—the same
step repeated over and over
- Difficulties
- Difficult to see the pattern, making
it hard to generalize the
steps.Returning to Steps 1 and 2
may help. Doing more instances of
the problem will provide more
information
- Step 4: Test Your Algorithm
- Test the algorithm with different values of
the parameters than the ones we used to
design our algorithm
- Also test any corner cases—cases where the
behavior may be different from the more
general cases