Rock-Paper-Scissors

Top-Down Design

The reason I asked you to write it down is that you need to think about what your program will do, or you cannot program it, and writing requires you to think. Except modern poetry, which is nonsensical, but everything else requires some thought. Programming requires a lot of thought, and you still need to write it down eventually, that's what a program is, a written description of what the computer will do in an unambiguous language (which English is not, but it's a good start for organizing your thoughts). Besides, we programmers always throw the first design away and start over. And the second. And third. You need something to throw away.

So if you skipped that first step, do it now, here in this text panel. If you did write it on paper, copy it to here:

Good design is what we call "top-down," that is, we start with the most general description of what the program will do -- in this case that's the title on this page -- and then break it down into its constituent parts. This game has two parts: (1) The introductory comments by the computer, to let the user know they are in the program they thought they were, and what's going to happen next, stuff like that, and (2) Playing the game.

Do you remember the "5 basic concepts" mentioned in the Preface, that all programs are made from? Here are the five again, in case you forgot:

Sequence
Iteration
Conditional
Variables
Input/Output
We just did that, a sequence, two steps in order (we can't play the game until the user knows whatever it is we need to tell them). The first step in the sequence is another concept from this list, output. The second step is also a concept from this list, iteration, each round, over and over.

You have more than that, right? Don't throw the baby out with the bathwater, look to see how what you have written fits into our top-down design. Discard the irrelevant, but keep the simple essentials. Then turn the page.
 

<<Previous | ToC | Next >>

[2021 June 8]