LORNA is 4, going on 5. I’ve never met her before, but her eyes light up when she sees me. She rushes over, blonde curls bouncing. “I’m going to sit on you!” she declares. I demur, so she climbs into the chair next to me. “I weigh forty pounds!” she exclaims.

I hand her the iPad I’m carrying and the silliness melts away in an instant. A teacher helps her load up an app, gives her a quick tutorial and she’s off, pulling at icons, stringing instructions together, building animations. Lorna is on her third day of learning to program a computer.

Lorna and her classmates, who range in age from 4 to 7, are taking part in a pilot study here at Tufts University in Medford, Massachusetts, to see how young children respond to ScratchJr, a spin-off of the Scratch programming language. Scratch was invented to teach students as young as 8 how to program using graphical blocks instead of text. Now even children who haven’t yet learned to read or write are getting in on the act.

Advertisement

Tools like Scratch aim to address what their developers see as a lack of computer programming instruction in schools today. The general thinking is that children are growing up surrounded by powerful machines they do not understand and teaching needs to be overhauled to prepare today’s youth for a future living and working closely with computers.

Unlike typical programming languages, which require users to type in complicated text commands, Scratch uses coloured blocks that are strung together to create lines of code. ScratchJr is similar, only the commands are even simpler. After assembling a rudimentary program, the child clicks a green flag at the beginning of the list of commands to run it.

It may sound very simple, says Marina Bers at Tufts, who co-created ScratchJr, “but it teaches sequencing – the idea that order matters”.

Concepts become more complex as the child progresses. On just their third day with ScratchJr, the youngsters are being introduced to the idea of programming tasks in parallel – in this case, making a snake wriggle across a grassy meadow while a bird glides down from the air. This involves two separate strings of commands, one governing the bird and the other the snake, and they must be made to work simultaneously.

Once the students have completed their task, they get the opportunity to experiment with what they’ve learned. William, aged 6, adds a loop to his program, so the snake slithers through the grass over and over again. Then he adds a command so the bird only glides down after the snake has reached most of the way across the screen. In computer science terms, William is showing that he understands control flow – a concept every programmer must master.

Being able to think like this can help children with more than just computing, Bers says. Maths, science, even learning to write, all require children to be able to organise their thoughts into the best order.

Early exposure to programming seems to have helped some of the world’s top coders. Earlier this year, Google engineer Neil Fraser in Mountain View, California, polled over 100 of his co-workers about when they first picked up coding, and then compared that with their performance on a simple test of skills. He found that those who wrote their first code between the ages of roughly 8 and 11 were most likely to develop advanced coding skills.

People writing their first code at an early age are more likely to develop advanced coding skills

“We didn’t see an effect before 3rd grade, but certainly earlier is good,” Fraser says.

In the UK, the Department for Education is now looking to address the lack of programming taught in schools. Under draft guidelines for the National Curriculum, due to take effect in 2014, children are to begin learning the rudiments of programming at the age of 5. Coding is already proving popular with the nation’s children. Last year Clare Sutcliffe and Linda Sandvik co-founded Code Club, where children aged 9 to 11 learn how to build basic programs on Scratch at first and then move on to more complicated languages such as HTML. There are now 948 Code Clubs in the UK.

The picture in the US is much less rosy. Just over 10 per cent of secondary schools there offer computer science classes. The federal government does not consider computer science a core subject and allocates it little funding. “In the US, most computer science classes won’t start until grade 10 [ages 15 to 16], if you’re lucky,” says Fraser.

A bill introduced to the House of Representatives in June could change that, but the task of changing teaching practices has fallen mostly to advocacy groups like Code.org and the Computer Science Teachers Association.

Back in the classroom, William takes me through one of his creations – a program in which a bird flies out of a tree and greets a friendly cat. But the bird doesn’t fly on cue. “What?!” he exclaims, frowning. “Let me check the bird’s program.” He tweaks a few icons and runs it again. All fixed. I ask him whether he might like to be a programmer some day. “Probably,” he says. “It’s edging out ‘scientist’ right now.”

Correction&colon; We lowered our figure for the proportion of secondary schools in the US offering computer science classes since this article was first published on 26 July.

Building with blocks

With their brackets, semicolons and other odd-looking syntax, text-based programming languages can seem impenetrable. To make things easier, Neil Fraser and Ellen Spertus of Google built Blockly, a block-based language similar in style to Scratch and ScratchJr (see main story). The goal is to allow anyone to write short programs that can be used in text-based languages such as Python or JavaScript. Once familiar with the concepts, users are encouraged to move on to these languages to build more complex software. Fraser and Spertus hope Blockly, launched last year, will find its way into classrooms. It is already international&colon; Fraser wrote a version for Vietnamese schoolchildren earlier this year.

This article appeared in print under the headline “The kindergarten coders”