Matt Lerner
Matt Lerner

I wanted to expose my kids to programming because it’s a great skill and a powerful way of thinking. And my kids spend enough time playing Angry Birds and Cut the Rope on my iPhone that I figure they should get a peek behind the curtain at how programming works.

So whether you’ve never programmed before or you’re a hardcore HAx0r (hacker), here are some tips on teaching your kids to program.

Tip #1 Logo Still Rocks

When my oldest son Cy was four we started writing some Logo programs on the iPad using Mad Logo and making some animations using the kids programming language Scratch.

But to really give Cy a peek behind the curtain, I came up with some tricks to teach him Python programming. Python is readable enough for a kid to understand and powerful enough that we use it for almost everything at my startup Walk Score.

Tip #2  Python Is Already Installed On Your Mac

Did you know that Python is already installed on your Mac?  All you need to do is open the Terminal application and type python to get started (type ctrl+d to exit Python).  Learn Python the Hard Way has everything you need to start programming in Python.

Tip #3 Make the Computer Talk

Here’s my main hack to get kids to pay attention, make the computer talk!  This is super easy on a Mac.  Open the Terminal application and type “say hello.”  The computer says, “hello.”  Magic!

Tip #4 The Number Guessing Game

Here’s some code for a number guessing game in Python.  To run this program:

1.  Download the source code

2. Open the Terminal application

3. In the Terminal application type: cd Downloads

4. Type: python mathquiz.py (make sure your volume is turned up on your speakers!)

Since this is a real guessing game, my son Cy liked to just play it at first  — and eventually got interested enough that we could walk through each line of the program to talk about how it works.

Open this file with a text editor (I’m using Sublime but you can use the built in TextEdit application on your Mac) and try changing max_number to 100.

Tip #5 The Internet Has Everything Else You Need

Let’s say you want to teach your kids about a more mind-blowing programming concept like recursion.

Don’t remember what recursion is?  Or in my case, I’m wondering how the heck I explain something this complicated to a kid?!  Khan Academy to the rescue!  Here’s a great video from the Khan academy explaining a recursive factorial program.

And here’s the code I used with my son Cy.  At 6 years old, I think he’s too young to understand recursion but he sure likes seeing the computer make really big factorial numbers!

I’m sure there’s some six year old somewhere who has already made a million dollars selling an iPhone game that they programmed themselves. But to be honest, my kids haven’t started writing any programs of their own.  In fact, I’m not even sure they’re interested in programming!

But my son Cy has gotten obsessed with math concepts like factorial because of this little exercise and more importantly he’s seen that programming is something that anyone can do! Check out Code.org for a wealth of resources on teaching and learning programming.

Matt Lerner is the CTO and Co-founder of walkscore.com.  Follow Matt on Twitter.

Like what you're reading? Subscribe to GeekWire's free newsletters to catch every headline

Job Listings on GeekWork

Find more jobs on GeekWork. Employers, post a job here.