top-down design

Now that you know what you need to accomplish with your program, you now need to knowhow you can accomplish it. The approach used to do that is called top-down design and this simply means putting all the important main parts of the program in to a list.
CollectNewspaperKarelAn example I want to use is from a Karel world. In this example, Karel needs to collect the beeper (which is called a newspaper in the assignment). The assignment states that Karel’s world doesn’t change and that the door is always where it is and the paper is always on point 6,3 and that when collected, Karel needs to return back to the start.
A top-down design approach could go something like this:
1. Walk to paper.
2. Pick it up.
3. Return back to start.
This is our top level that describes what needs to be done in the most basic form. I guess we could start at an even higher level and simply say “Collect paper”, but programming problems can be tackled in many ways and the way above is simply the way I have decided to do it.

No comments:

Post a Comment