IBM SC34-5764-01 Server User Manual


 
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.
Reconsider the Data
When you are refining your program, your objective is to make each piece simpler. This almost certainly
means:
v Simpler input data for each segment or routine
v Simpler output data for each segment or routine
v Simpler processing
v And, therefore, simpler code.
If your pieces really are simpler, they will probably have simpler names, too. For instance:
v Knit cuff
rather than
v Make ribbing for cuffs and waistband.
Correcting Your Program
If you cannot understand why your program is giving wrong results, you can:
v Modify your program so that it tells you what it is doing
v Use some of the REXX interactive trace facilities (See “Interactive Debugging of Programs” on page
411).
You will gradually learn which of these techniques suits you better.
Modifying Your Program
You can put extra instructions into your program, such as:
...
say "Checkpoint A. x =" x
...
say "End of first routine"
...
Tracing Your Program
Or you can use the TRACE instruction, described on page 166.
v To find out where your program is going, use TRACE Labels. The example shows a program and the
trace it gives on the screen.
Programming Style and Techniques
Chapter 10. Programming Style and Techniques 95