Now Is the Time to Teach Your Kids to Code

Spend a weekend — or a monthlong at-home break — giving your kids a taste of programming

Photo: Sally Anscombe/Getty Images

IfIf you’re like millions of parents across the world, you’ve suddenly crashed into an unplanned at-home break with your kids. Many of the usual options for educational enrichment — museums, galleries, concerts — are shuttered. Helpful distractions like parks and playdates have been swallowed up by new rules of social distancing. And the odds are good that you’ll need to balance the chaos at home with the ongoing remote work requirements of your own job.

Here’s the good news: There is a way to keep your kids busy and help them learn something truly useful. Best of all, they can stay in their pajamas while they do it (pending parent approval, of course).

The answer is learning to code.

How to find good learn-to-code activities

In the past decade, the world has gone crazy for code-themed education. There’s an iPad app or battery-devouring robot caterpillar for every age. Many of these toys and games are perfectly fun activities that do very little to teach actual computer science concepts. To be kind, they overpromise. (To be less kind, their claims are bunk.)

That doesn’t mean we should teach our kids to code in the same way we teach adults. When it comes to interest and concentration, kids are all over the map. Some might be perfectly comfortable powering through an online Codecademy course about JavaScript. Others won’t stay engaged unless they have the opportunity for creativity and free play.

After three daughters and plenty of experiments, I’ve learned that you get the best parent-effort-to-child-learning ratio when you start with smaller chunks and discrete activities. I call this approach a “taste of programming,” and — in true nerd parent fashion — I used my experience to build a flowchart that can guide you through the options.

For a closer look, check it out at full-size (and its related links). Or, read on to learn about a few of the key decision points. That said, keep in mind that this flowchart is a snapshot of good advice based on my experience. If you take a path that isn’t mapped out on this chart, that doesn’t mean it’s wrong.

Programming off the computer

Most programming involves sitting in a chair and staring into the glowing screen of a computer. But as the flowchart shows, there’s another path — you can go offline with activities that take place in the real world.

For a light taste of code-themed entertainment, try RoboRally. It combines the old (it’s a board game) with the new (algorithmic thinking). Each turn, you plan out a short routine of instructions that you hand to your robot to “execute.”

For kids who love to read, there are a few gems buried in the avalanche of STEM (science, technology, engineering and math) titles at your local bookstore. Go past the hollow picture-book tutorials and pick up Computational Fairy Tales by Google principal engineer and algorithms expert Jeremy Kubica. It’s an insightful look at actual computer concepts that come to life in a fictional world. (Lauren Ipsum is another good read.)

Many of these toys and games are perfectly fun activities that do very little to teach actual computer science concepts.

Visual languages

If you’re ready to start programming at a computer, you face another choice. Should your child use a text-based language or a visual one?

Visual languages let kids assemble a program by snapping blocks together on a blank canvas. It makes for a lot of clicking and dragging, but it’s also a perfect first step for kids who don’t yet know how to type.

A visual program that makes an agent wander around a ‘Minecraft’ world, destroying whatever it meets.

There are plenty of visual programming languages in the world. Here are the most well known:

  • Scratch is the original free visual programming language created by the MIT Media Lab. The best part of Scratch is that it’s completely open-ended. This is sometimes the worst part, too, because many kids spend all their Scratch time making artwork or scripting stories. (Which is fine — an afternoon of art and creative writing is as good as an afternoon of coding.) For a particularly timely example, check out this Scratch epidemic simulator.
  • Blockly is a Google-created visual programming language. It powers the simple coding simulations on the Hour of Code website. These are fun for a quick diversion, but kids won’t learn nearly as much as they will if they make their own programs. You can also use Blockly to control the whimsical Dash robot from Wonder Workshops — super fun, but pricey.
  • MakeCode is Microsoft’s visual programming language. You can use it to build simple arcade games or to twinkle lights and play music with the affordable (roughly $20) micro:bit board. (The micro:bit is a great option for kids who are interested in electronics because it brings their code out of the screen and into a real-life object.) Or, if your kid loves Minecraft, they can use MakeCode to hack their favorite game and learn a bit of programming on the way.

Python

When your kid is ready for a bit more challenge (and a lot more freedom), it’s time to step up to a traditional text-based language. But which one?

If you don’t want to make web apps, the easy top choice is Python. No language so neatly spans the vast ocean between beginner programming and serious work, stretching from simple games to data science. The book Python for Kids is a great starting point. But to get the most fun for the least amount of work, I recommend pairing Python with the game-creation tool Pygame Zero. It draws on the popular pygame toolkit but simplifies it radically, saving new coders from writing huge blocks of boilerplate code. It’s such a good first choice that there are barely any second choices worth mentioning.

HTML and the web

The challenge of writing web apps is obvious: There’s a stack of technologies to master. The advantage is that a web app can run on almost any computer or device in the world, with no setup required. For kids, it offers the perfect way to share their creations with friends.

Before anyone can put code in a web page, they need to have some understanding of HTML, the markup language that structures the content in a page. But you don’t want to spend too much time on HTML because writing web pages is a poor second cousin to writing code. So how do you fill the gap?

One option is a course like Khan Academy’s Intro to HTML & CSS. But it’s often quicker (and more fun) just to let your kid experiment with some sample HTML markup. One of the best tools for this job is X-Ray Goggles, a Mozilla-created project that lets kids manipulate the HTML on the sites they visit. It’s like a simplified kid version of the Chrome DevTools. Teach them how to use it with Messing Up the Web, a certified non-boring tutorial that kids can do on their own.

I’ve learned that you get the best parent-effort-to-child-learning ratio when you start with smaller chunks and discrete activities.

JavaScript

Getting started with JavaScript is a steep climb. You need a few non-negotiable ingredients, like a basic HTML document, a script block, and some event wiring. But one fast-track way to introduce JavaScript without wading through too much theory is to use prepared examples. The basic idea is that you start with a prebuilt page. Your kid learns by modifying, correcting, or improving the code in that page.

The fastest way to get started with prepared examples is using Codepen, a website that lets you write and test JavaScript in your browser. You can create and save your own pages or check out a huge community of other people’s work. To get started, try out these complete-newbie exercises that include an introduction to the JavaScript event model and an overview of common JavaScript events.

For a more comprehensive tutorial, you can check out A Tiny Introduction to JavaScript, the free ebook I wrote to introduce the language to my daughters. And as a kid or teen progresses, you may eventually want to step up to a design tool that you can install on your computer, like Visual Studio Code, which gives you helpful features like error checking and interactive debugging.

But if you get to this point, you’ll be far beyond a taste of programming. You’ll have invited your kid all the way into the crazy, fun, frustrating world of software development. Is it a life skill that every child must master? Probably not. But it is a useful trick to keep in your back pocket.

Teacher, coder, long-ago Microsoft MVP. Author of heavy books. Join Young Coder for a creative take on science and technology. Queries: matthew@prosetech.com

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store