You Already Know How

 
This page is for people who never programmed a computer, or maybe tried and didn't succeed.
If you already programmed in Scratch or Python or JavaScript, use our Java FastTrack >>
(ToC)


Video Introduction (8 minutes) <<--- Watch this video first, then

English IDE<<--- Click this link and write your first program here.

When it runs without errors or warnings, Raise your hand in Zoom so we can see it.

If you didn't watch the video, or if you didn't pay much attention, and if you cannot figure out why your program does not run properly, you might reconsider: Watch the Video.

Or, if you are like me and prefer to read at your own pace instead of whatever pace set in some video, You can read the transcript (and probably come out ahead of the non-readers).
 

Video Transcript: 1. You Already Know How

All programmers know -- and some of us even admit -- that computers are an imperfect mirror of the real world we live in, so programming computers similarly reflects what you already know how to do IRL. Let me prove it.

Not everybody eats peanut butter & jelly sandwiches, but it's reasonably healthy (balanced protein) and pretty much everybody knows how to make a PBJ, even if you have more fun things to eat most of the time. So it's a program that you can write and another person -- or (today) a computer -- can run to make a PBJ.

A program is a sequence of steps to be done in order. The order matters. Sequence is the first of a half-dozen ideas you already understand, but we will explain these ideas again here in the context of a program, telling the computer to do something, and the first program you see here will be a program you write, how to make a PBJ.

So let's write the program here in English. Click this button to open our "Integrated Development Environment" in a new window, which you can position to one side or above or below the instructions in this page:

On the left side is a panel for you to type program lines into. On the right side a where the output happens. At the bottom is an alphabetical list of what you can tell the computer to do in making a PBJ.

Start by typing this line into the program panel, then click Run:

see kitchen
This opens up a view into the "Kitchen Computer" that will run your sandwich program.

In the video I start with this set of instructions for making a sandwich:

get bread
get peanut butter
get jam
spread PB
Put bread pieces together.


If you tried it -- go ahead, you can't hurt anything -- it stops on the first line with an error message. Computers are incredibly stupid, you must tell it in very precise detail exactly what you want it to do.

Do you see any bread in the kitchen? Neither do I. It's probably in the pantry. So change the first line to read:

get bread from pantry
Now what? Did you think the computer could spread the PB with its fingers? It doesn't have any fingers. Try:
Get knife from drawer.
What did it complain about next? Do you see a line in the Reference section that you can add to fix the problem?

Now what? You see a loaf of bread. I see a loaf of bread, but the computer doesn't see it? What's up with that?

Did you ever try to spread your peanut butter on an unopened loaf of bread? What do you need to do before you can see a slice of bread on a plate ready to spread peanut butter on? Look at the lines in the Reference section for hints. If you are completely flummoxed, you might take a quick glance at the video for a hint. But I think you are smart enough to figure it out.

Finish the sandwich yourself, then let us see what you did. Programmers share their code.

[2021 August 13]