Teaching my 10-year-old daughter to program
If you like this, read another by Robbie: Replacing My Kid’s College Fund with a “Start Something” Fund
My wife and I have been reading to my 10-year-old daughter every night before bed since she was an infant. I say “my wife and I” when I really mean “my wife 90% of the time.” With our most recent addition to the family (now a 2-year-old boy), my wife doesn’t get to read to my daughter as much. That means I’ve gotten the opportunity to do it more. Her old pops likes to freshen things up, so we don’t always read (I can read Diary of a Wimpy Kid only so many times). Sometimes we play cards. Sometimes we’ll just talk.
From her earliest days, I’ve talked about my job and what I do. Running a startup isn’t always glamorous and I involved her any chance I got. Occasionally, she’d help decorate my office for an event or help me rearrange furniture. I even took her along to watch me keynote a local software developers conference. For two years she was an “intern” at Automated Insights during the summer. She’d go in with me one day a week and we’d give her odd jobs to do around the office — refilling snacks, cleaning the whiteboards, etc. She’d even attend some meetings.
She knows Daddy is a programmer, but she never really knew what that meant. That is, until a few weeks ago. One night I asked if she wanted to learn how to program. With surprising excitement, she said she did. I told her to grab a notebook and a pencil. Over the course of several nights we talked about programming. Each night I asked if she wanted to read or talk more about programming and she picked programming each time. Cool.
What does a Programming 101 curriculum look like for someone that is just getting comfortable with division and spends her spare time making slime? It was all completely on the fly and I tried to relate it to things that a 10-year-old girl likes (specifically, American Girl Dolls).
After we got through all the high level concepts (e.g. what is a program?), we moved on to the notebook.
This was first night in the notebook — variables and constants:
I find Ruby to be one of the most readable languages, so I decided to use that as a basis. But I wasn’t focused on strict syntactic structure — I used lots of pseudo-code. Just the basics. At this stage it’s all about concepts. We’d spend around 30 minutes each night — 10 minutes on review and 20 minutes on new material.
The next night was all about functions after we reviewed the previous night’s material. These were pretty foreign concepts for a 10-year-old, so plenty of review was necessary.
Ok, so functions. This took a little more time to grasp. Unfortunately, my on-the-fly example wasn’t the best. Instead of a function with several lines of code, I wrote a single-line function. The whole point was that functions reduce repetition.
After that we covered some basic data types, then conditionals and (simple) boolean logic. All of that went well.
With all of that under our belt, we were ready to write a real program! I recall the first few times I wrote a program in my early teens. It’s kind of magical the first time you see the results from a program that you wrote. You gave the computer some instructions and it executed the code!
We created a simple ruby program called haircomment.rb. Considering she still doesn’t know how to type well, entering the code was a little painful, but she got through it. She enjoyed running it from the command-line (also, a new concept).
I don’t know where we’ll take it from here. Maybe we’ll keep going or maybe we’ll revisit it occasionally. My intent wasn’t to force anything and if all she gets out of it is having a vague idea of a “variable” or a “function” if she ever takes a programming class in school, I’ll be happy.