Programming education has become a lot more mainstream in the past few decades, but much of the materials are still targeted at middle school and high school audiences. What if you’ve got younger children and you don’t want to wait to teach them how to make software?

Well, I say you don’t have to! My daughter Coraline and I have been programming together since she was five years old, and I’d love to share six keys to our successful work together.

Tip #1: Break out the paper first

dadtipWhen we think of programming, our first instinct is usually to reach for the keyboard. But wait! The point of teaching children programming isn’t just the syntax and systems. It’s how to think about problems.

For programming lessons with Coraline, we always start on paper. We brainstorm about our program’s appearance and behavior. Much of our work is desktop GUI programming with a Ruby framework called Shoes, so we sketch screens, talk through mouse-clicks and key presses, and—most important—choose colors for everything!

For most projects we spend more than half our “programming” time planning, and that portion can be great fun on its own.

Tip #2: Fast results and small batches

Patience generally isn’t the strong suit of young children. As the adult it’s your job to find a way to work within the constraints of youngsters’ attention span.

Focus on getting results on screen as soon as possible. If you’re doing something text-based, can they type the commands in immediately? If you’re writing a GUI, get that first rectangle drawn on screen right away. If it’s a hardware project, what’s the shortest set of steps to seeing it move?

Keep in mind how long the kid is likely to stay engaged. I rarely get more than 15 minutes of my daughter’s undivided attention, and sometimes less! Changing things up, such as moving from planning to coding, can sometimes buy you more time, but don’t count on spending the whole afternoon holed up with the laptop.

coraline clark

Tip #3: Try things first

With such tight timelines, you’ve got to come prepared. If you’re doing anything unfamiliar, it’s worth trying it out by yourself before sitting down with your kids. You don’t want to chew up those valuable minutes Googling errors messages.

Is this cheating? Not at all! The goal is to show a kid the possibilities of programming, not to doggedly complete a checklist of steps.

And what if you do hit a snag? It’s great for kids to see that adults make mistakes too, that we don’t know everything, and maybe a bit about how we start to solve things. But don’t be offended if their interest wanes while you dig in for a long debugging session.

Tip #4: Give them real tools!

Kids’ programming environments are great, but it’s been so fun introducing Coraline to the real programming tools I use daily. This meant showing her how to edit text with Atom, and introducing her to the command line.

coratipAfter all this talk of keeping things simple and fast, why would I drop into something as arcane as a Unix prompt? Well, there’s a lot of simplicity in that text-based interface. My daughter loved the immediacy of typing a command, hitting Enter, and seeing the result. While I won’t be quizzing her on the command-line arguments to tar anytime soon, the basics were fun and useful for her to experience after all the years of GUIs and iPads.

She’s even seen other people using terminals since and gleefully shouts out when she recognizes the “ls” command.

Tip #5: Don’t get hung up on what’s right

There are many concerns to balance when writing code professionally: keeping methods clean and short, naming variables well, not needlessly rewriting code others have already created, proper error handling, and so on.

Forget about all that! The surest way to lose a kid’s attention is to dive too far into details that they grasp only hazily.

raspberry piThis was really brought home to me when working with my daughter on a Raspberry Pi. We wanted to take pictures, and my first thought was “What sort of libraries are out there for taking photos?” I quickly realized Coraline didn’t know what a library was and that she’d check out as soon as I started hunting for Ruby gems.

But she did know how to type at the command line, and there was a terminal app for taking pictures. So we typed on the command line, then copied those commands over into our Ruby script.

Is this the right way to architect a reliable, highly maintainable system? Hardly, but that’s not the point. Did we get results she understood and was proud of? You bet!

Tip #6: Let them drive

I’ll close with one of the hardest, but most important pieces of advice for coding with kids: Keep your hands off the keyboard.

Can this be maddening at times? Of course, but how do you expect them to learn and grow if all they do is watch you write gibberish when you “program together?”

I try my best to let Coraline do all the typing and take the keyboard only with her permission. It’s gotten easier over time, and it’s given her a sense of ownership and mastery over the computer that I don’t believe she’d have gotten otherwise.

Conclusion—and a presentation!

There you go, six tips to help you be successful when teaching coding to younger kids. With the holidays around, maybe take a bit of that time off to show the young people in your life what they can do with a computer!

Bonus: My daughter and I had the opportunity to present at RubyConf 2016 on this topic. We tell the story of building a Rasperry Pi-based monitoring system for our chicken coop. There’s a bit of Ruby, a bit of hardware hacking, and a lot of fun along the way. You can see Coraline’s Hackety Hack code here and the Chicken Spys app here. I hope you enjoy it:

Resources for coding with kids

  • jason and coralineHackety Hack: A kids’ programming environment for Ruby
  • Shoes: Ruby GUI framework, the basis for Hackety-Hack
  • Scratch: An online, visual programming tool
  • Raspberry Pi: The main site has tons of great videos, tutorials, and introductions
  • Anybody can learn to code! (And they’re a New Relic customer—they even presented at FutureStack14!)
  • Hello Ruby: Hello Ruby is a whimsical way to learn about computers, technology, and programming. The story started with a book, and now Ruby continues her adventures in exercises, games, and apps.
  • Kids Ruby: A kids programming environment for Ruby, with content and lessons
  • Teaching Kids Ruby: GitHub repo with discussion of teaching kids Ruby


Photos courtesy of Jason Clark. All drawings by Coraline Clark.

View posts by .

Interested in writing for New Relic Blog? Send us a pitch!