Skip to main content
opinion

Clive Thompson is the author of Coders: The Making of a New Tribe and the Remaking of the World, and a contributing writer to The New York Times Magazine.

Nearly every programmer knows when they fell in love with the craft.

It’s usually when they run their first “Hello, World” program. The coder writes a rudimentary piece of code that makes the computer print out a statement, often a greeting such as “Hello, World!” or their name (“Hello, Clive!”). Then they place the command on an infinite loop. When they run the program – voila! “Hello World! Hello World! Hello World!” spills endlessly down the screen.

It’s an electrifying, Promethean experience: You’ve breathed life into the machine with your incantations. One coder I know, James Everingham, was a teen when he wrote his “Hello, World” command back in the early 1980s. “I thought it was magic,” he told me, and vowed, “I must know more.” Over the years, he devoured coding books and eventually became part of the team that made Netscape, the first web browser. When I interviewed hundreds of programmers for my recent book, Coders, they all had similar, magical stories to tell.

Those “Hello, World!” stories came to mind when I learned that Ontario is making computer programming part of its elementary school curriculum. Those electrifying introductory moments can tell us a lot about the true value of teaching children to code – and it isn’t always what you’d expect.

If Ontario is teaching coding in hopes that they’ll create a generation of well-paid, professional coders years later, I’m afraid the province will be disappointed. I suspect only a minority of people will ever really want to be full-time coders; like medicine or journalism or construction, it’s not a job for everyone.

Do we hope coding will improve children’s math skills? It’s not likely. Despite its nerdy reputation, much coding requires almost zero math.

So what does coding offer a young child? If you ask me, it gives them a more subtle and philosophical glimpse into the world, and themselves.

First off, programming gives students a taste of power. People are forever telling children where to go and what to do. When they program a computer, by contrast, they command a completely obedient device. The machine does exactly what they tell it to.

“When you’re a kid, that feeling is wild,” one programmer told me. “It’s like you have a little universe to control.” For a child, who has so little authority, coding invokes a sense of possibility; you imagine all the things you could coax a computer to do. It opens a window in the soul.

Yet – in what may seem like a contradiction – coding is also brutally, grindingly frustrating. Sure, computers will do exactly what you say, but they need precise, accurate instructions. The tiniest error – a colon misplaced, a badly formed command – and the program won’t work.

You’ve seen movies where programmers pound out torrents of code? That is nothing like reality. Most of the time, coders don’t type at all; they sit and stare morosely at the screen, running their hands through their hair, trying to spot what they’ve done wrong. It can take hours, days, or even weeks. But once the bug is fixed and the program starts working again, the burst of pleasure has a narcotic effect.

The upshot is coding teaches – and also rewards – dogged persistence. It shows us that errors are a normal part of life and that careful, patient work can repair them. It also teaches the coder to think experimentally, to patiently test every possible reason their code isn’t running. This is a powerful experience for young children.

There are many other quieter, less-obvious benefits of programming. Coding is part of modern civics: Once you know even a bit of coding, you can more readily debunk Silicon Valley’s gauzy hype. Coding can be deeply artistic: I know programmers who couldn’t care less about making apps or commercial software – they use code to make art and music. (I’m that way, myself. My most popular creation is a Twitter bot that composes poetry. It has zero commercial value, but brings me constant delight.)

So by all means, we should introduce children to these profound moments. Making coding mandatory also makes the world more equitable, ensuring lower-income children, racialized children and girls – groups that have traditionally been sidelined in programming – get to have these experiences.

Nonetheless, I can see problems in Ontario’s plan. For one, it requires elementary-school teachers – already juggling crowded classrooms – to become fluent enough in basic coding to teach it. I’m not sure that’s fair, or truly possible. It potentially reduces class time for basic literacy and numeracy, which are far more crucial subjects. And as with all subjects, turning coding into compulsory schoolwork might turn it into a slog.

That would be depressing. The sheer joy of programming is, to me, the whole point. Coding is a fun thing to do. It’s captivating, maddening, powerful and deeply weird. If we teach it, we need to teach it right – and make it more than a chore.

Keep your Opinions sharp and informed. Get the Opinion newsletter. Sign up today.

Follow related authors and topics

Authors and topics you follow will be added to your personal news feed in Following.

Interact with The Globe