Stepwise Refinement: An Example

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.
  1. Knit front
  2. Knit back
  3. Knit left arm
  4. Knit right arm
  5. 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.


Task Task

Feedback


Timestamp icon Last updated: Tuesday, 7 January 2014


http://pic.dhe.ibm.com/infocenter/cicsts/v5r1/topic/com.ibm.cics.rexx.doc//dfhrx/refine.html