My son’s first programming lesson

This morning I was working from home at the dining room table while my 5 year old son ate his breakfast of Frosted Mini Wheats beside me. Baby was running around destroying things and sister was still asleep.

At one point, I got a pen and paper and started diagramming inputs and control flow (for a deployment script triggered by Jenkins). My son asked what I was drawing, so I explained variables, as best I could, with names like TARGET_APP_SERVERS, BUILD_NUMBER_PRODUCING_ARTIFACT, and JOB_GOAL.

I figured it would go over his head and I could get back to work. But he asked a follow up question. “What is your GOAL”?

“To upgrade the program on the servers or to just restart the server,” I explained.

But he wasn’t satisfied. “What do you want to do — upgrade or restart?”

“Upgrade”, I said.

I started to get back to work, but he wanted to sit on my lap. I decided it was time.

I opened a text editor and wrote out a little program.

name = input("What is your name? ")
print("Hello " + name)

It was very similar to my first program, at age 7, though mine was in BASIC on a TRS-80.

I read the code to him and explained that NAME would be replaced with what he input (or typed).

That says “Hello” he said, pointing to the screen before I got to the second line. His mom is a good teacher.

We fired up the program in the console and I watched him hunt and peck to spell out his name on the keyboard with all the mixed up letters. Then I showed him how to press enter.

“Hello harmon” the computer wrote back.

I ran the program again, this time he requested I enter my name.

“Hello Aaron” it printed.

He was delighted. I added some other lines and watched him practice spelling and reading the output to him

What is your name? harmon
Hello harmon
What is your favorite color? red
I like red too
What is your favorite toy? lego
lego is fun to play with!
What is your favorite show? jang bricks
I don't like watching jang bricks, I prefer My little pony

The last answer was not satisfactory to him, but I’m sure his sister (still sleeping) would appreciate it.

“How is it so smart?” he asked, adding “Computers are like people!”

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s