Late-Breaking News (Calc)

(This Is Not In the Video)

One Step At a Time

A very important part of programming is understanding what you are doing at the appropriate level of detail. The Six Essential Ideas that we repeat over and over is at the bottom of that hierarchy. When you are looking at the program at that level, each command -- each line in English -- is always exactly one of those Six. Maybe I didn't emphasize it enough in the videos so far.

But we cannot think at that level for the whole program all at once, the human brain does not have that kind of capacity. This I did say. So we start at the top, one line says what the whole program does, like

"Make PBJ"
or, in today's program:
"Calculator"
Then in a small number of lines (I recommend two or three) of not-very-many words, you say what the major parts of the Calculator or making a PBJ, or whatever are. The major parts of making a PBJ are (1) get the stuff, and (2) put it together. The major parts of what a calculator does are (1) get the numbers, (2) do the math, then (3) display the result. That's in the video.

Then for each of those items, either it's already one of the Six Things and you write the proper code for it, or else you can treat it like it's a program all by itself, and repeat the process. Sometimes you can stop after two levels, you are already at the Six Things, and most of the time you might go down six or ten or twenty layers before you get to the Six Things. There are about two or three layers for the Calculator. That's in the video, watch for it.

Every program you ever do in this class, you need to go through this process, because the programs you write will get bigger as you become more skillful, and when you start writing your own program, it will be way too big to skip this process. You must do it, or you will fail, your program won't run properly. All this is in the videos (some of them you have not yet seen).

What's not in the video (at least not yet), is when you get to the bottom, when you are coding each line as one of the Six Things, each line, each command (English or Java or Python or whatever) is only one step, only one of the Six Things. You cannot put more detail into it and have it do a bunch of extra stuff. If you try to do that, the computer will get confused and (probably) give up and call it an error. Or maybe it will do something you did not intend. There are no "Assumes" after you leave the PBJ in the Kitchen.

If you are doing Input, you input one value, and it goes into one variable. If you are assigning a value to a variable, you are changing one variable at a time, and you might be doing math to get that value, but you are not doing input, you are not printing, you are not deciding a conditional or starting a Repeat at the same time. Later, when you get to Java, you might do a function (subroutine) call to get a value as part of the math, but that's not always a good idea. Keep it simple. In English it's a requirement.

One Step At a Time.

They are small steps. It sometimes makes programming tedious, but when it's running, all that tediousness is forgotten, your program runs! Keep your eye on the goal, and do what needs to be done, and you will get there. (Besides TDD) there are only Six Things you need to know. You can do it, if you want to.

Revised: 2022 September 28