Designing a Program

About this task

Still thinking about method, which is just as important as language, let us take another look at CATMOUSE EXEC.

The program is about a cat and a mouse and their positions in a corridor. At some stage their positions will have to be pictured on the screen. The whole thing is too complicated to think about all at once; the first step is to break it down into:
  • Main program: calculate their positions
  • Display subroutine: display their positions.
Now let us look at main program. The user (who plays the mouse) will want to see where everybody is before making a move. The cat will not. The next step is to break the main program down further, into:
Do forever
   call Display
   Mouse's move
   Cat's move
end
Conclusion

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/designp.html