About this task
Granny is going to knit you a warm woolen garment to wear when
you go sailing. This is what she might do.
- Knit front
- Knit back
- Knit left arm
- Knit right arm
- Sew pieces together.
Each of these jobs is simpler to describe than the job of knitting
a pullover. In computer jargon, breaking a job down into simpler jobs
is called
stepwise refinement.
At this stage, look at the specification again. A sailor might
need to put on the pullover in the dark, quickly, without worrying
about the front or back. Therefore, the front should be the same as
the back; and the two sleeves should also be the same. This could
be programmed:
do 2
CALL Knit_body_panel
end
do 2
CALL Knit_sleeve
end
CALL sew_pieces_together
In programming, the best method is
to go on refining your program, working from the top, until you get
down to something that is easy to code.
Top down is the best approach.