Why we should teach children to code

By Simon Peyton Jones. Posted

Simon Peyton Jones explains the numerous benefits of teaching coding to children

In his March 2019 blog post, Andreas Schleicher, Director of Education at the OECD, asks “Should schools teach coding?”, somewhat mis-reported in the press as “Teaching children coding is a waste of time, OECD chief says”. But it’s a good question. You can find the links to both articles at the bottom of this article.

Let’s start at the beginning, though. Technology moves fast. To equip our young people to flourish in a world of change, we therefore strive to give them a foundational understanding of the world that surrounds them, and an intellectual toolbox that equips them to deal with successive waves of technology. For that reason, the new computing curriculum in England, introduced in September 2014, establishes computer science (not just coding, and with computational thinking at its core) as a foundational subject that all children learn, alongside maths and natural science, from primary school onwards. The previous Information and Communications Technology (ICT) curriculum was focused on, well, technology. The new curriculum is focused on ideas and principles. As the famous aphorism puts it, “computer science is no more about computers than astronomy is about telescopes”.

But if computer science is not about computers, what is it about? It is the study of information, computation, and communication. Take information, for example: suppose I show you a picture of the French national flag, and one of the Mona Lisa, and ask ‘which picture contains more information?’. What does that even mean? A way to make the question more precise might be, ‘Suppose I dictated instructions to you over the phone; which picture would take longer for you to reproduce?’. 

Clearly the Mona Lisa has more information in this sense: it would be a slow and painstaking job for me to dictate instructions to reproduce it at your end, even rather approximately. Thus, we have begun to speak of information as a measurable quantity. We start to think about how tightly we could compress data before transmitting it and how we could detect, and perhaps correct, errors made during transmission. All this is called information theory; it is part of computer science, it has a substantial body of theory, and it has immediate practical consequences.

Where coding fits in

What then, is the role of coding or programming (the terms are roughly equivalent) in computer science? Coding is not the message of the new computing curriculum: it is its medium. Coding is the labwork of computer science: it motivates, illuminates, and brings to life the dry bones of theory. Without programming, computer science would be a dry, theoretical husk of a subject. Imagine a music lesson where the students only studied the rules of counterpoint or the structure of sonata form, but never brought them to life by performing or composing such music!

But that’s not all: programming is more than mere medium. As Fred Brooks put it, “the scientist builds in order to study, but the engineer studies in order to build”. Most of the body of knowledge is organised around the challenge of building ever more ambitious edifices of software, and have them actually work and be useful. Programming is the very stuff of computer science.

Coding is phenomenally creative. The same Fred Brooks wrote that, “the programmer, like the poet, works only slightly removed from pure thought-stuff. He builds his castles in the air, from air, creating by exertion of the imagination. Few media of creation are so flexible, so easy to polish and rework, so readily capable of realising grand conceptual structures.” 

When a child does a science experiment, she is seeing physical principles at work, coming to life in front of her eyes. But if she does the experiment right, we know what will happen. In contrast, when she writes a program, no one knows what will happen. The programmer brings into the world a new creation, formed from an infinitely malleable substance, which does something new, conjured from the mind of its creator. We are not limited by the strength of wood, or the budget of the school workshop: in programming we are limited only by our own (in)ability to manage the complexity of our creation.

Self-assessment and risks

Coding offers immediate, tangible feedback. No need to wait for the teacher to mark your English essay; in computing, the program runs, or not, and remorselessly exposes the logical errors in your thinking. When hunting a bug in a malfunctioning program, we form a hypothesis about what is wrong. We formulate tests that will confirm or refute that hypothesis. In the light of the results of those tests we refine the hypothesis, and so on – it is the scientific method in action. Even for students who will never explicitly ‘program’ again, programming teaches understanding and reasoning skills that are needed by everyone: business innovators (identifying the need/potential), scientists (working with data, developing computational models of scientific processes), of those procuring software (e.g. for the NHS, to know what is possible, what they should be looking for, what is good and what bad), or end users (because one must always have a notional machine model of what a piece of software is doing).

All that – but in addition, of course, programming is a tremendously useful and marketable skill. In every corner of business, and every part of our daily lives, there are programs, and they all need to be written, modified, fixed, and stitched together. There is tremendous demand for skilled programmers, who command high salaries as a result.

And yet, and yet. There are two risks here. First, the risk that we confuse the medium with the message. I fear a future prime minister giving a speech saying, “the new computing curriculum has been a great success: every child leaves school fluent in Python”. What a disaster that would be! The computing curriculum is focused on ideas and principles, not on a particular technology like Python. Yes, some of those ideas (sequence, iteration, choice, abstraction) are directly embodied and brought to life in Python, but Python is just one embodiment among many, not the thing itself. Once pupils have learnt to code in one language, they should be able to quickly teach themselves others built on the same concepts, and also recognise those same concepts appearing in the wider world that surrounds them.

The second risk is that we may forget that the school computing curriculum is for the many, not the few. I certainly hope that the education our young people receive will inspire some of them to be the software developers of the future. But many more will become lawyers and plumbers, hairdressers and doctors. They all learn the elementary principles of natural science, and similarly should learn the elementary principles of computer science. And, just as mathematics appears in primary schools mainly in the guise of arithmetic, so computer science will appear mainly in the form of simple programming. Just as no one confuses arithmetic with the manifold glories of mathematics, so we should not confuse programming with computer science.

Life

Returning to Schleicher’s blog post, he says, “the risk is that we will again be teaching students today’s techniques to solve tomorrow’s problems; by the time today’s students graduate, these techniques might already be obsolete. We should instead focus on the computational thinking that underpins these techniques, and that students can use to shape the technologies of tomorrow.” 

Fair enough – and indeed computational thinking is already explicitly at the core of the English national curriculum from start to finish. But teaching programming is emphatically not “teaching today’s techniques to solve tomorrow’s problems”. Programming is computational thinking incarnate, brought to life, made tangible, executable, and useful. It provides a powerful way to practise and so develop those computational thinking skills, and understand them deeply. People occasionally say, “in the future computers will program themselves”, but I believe they are mistaken – we will simply increase the ambition of the programs we write.

So yes, to answer the question, we should teach our children to code. But we should do so not as an end in itself, but rather as a powerful and effective means to motivate, illuminate, and exemplify the underlying principles of computer science. There is no more intellectually exciting, creative, or practically useful subject. I want to convey to our young people a visceral sense of that richness and creative possibility, and by far the best way to do so is share with them the joy and beauty of programming.

Weblinks

Andreas Schleicher’s blog post.

Here’s how The Telegraph interpreted it.


UK Educator

Free

If you’re a UK-based teacher, volunteer, librarian or something in between, we'll send each issue free to your door.

Digital

Free

Just want to read the free PDF? Get each new issue delivered straight to your inbox. No fuss and no spam.

Buy

From £6

If you are UK-based but not involved in education, you can get hard copies by buying back issues.