“LET’S do it again,” calls a ten-year-old. Once more, pupils clasping printed numbers follow tangled lines marked with white tape on the floor of their school hall. When two meet, the one holding the higher number follows the line right; the other goes left. Afterwards they line up—and the numbers are in ascending order. “The idea is to show how a computer sorts data,” explains their teacher, Claire Lotriet.

This was the scene at a recent event in London to promote “Hour of Code”, an initiative organised by Code.org, a non-profit, aimed at rousing interest in computer programming—or “coding” in the language of the digital cognoscenti. In September, when computer science becomes part of England’s primary-school curriculum, such games are likely to become a common sight in the country’s classrooms. Many other places are beefing up computer-science teaching, too. Israel was an early adopter, updating its high-school syllabus a decade ago; New Zealand and some German states recently did the same. Australia and Denmark are now following suit. And the coding craze goes far beyond the classroom: more than 24m people worldwide have signed up to free tutorials from Codecademy, an educational website.

When computer science was first taught in some American and European schools in the 1970s, generally as an optional subject for older pupils, computers did little unless given instructions in a specialist language. So classes focused on programming. But the advent of ready-made applications and graphical user interfaces in the 1980s saw a shift to teaching “ICT” (information and communications technology): how to use computers for word-processing, creating presentations and the like. The result was that pupils left school with little idea how computers work. England’s ICT curriculum has come in for particular criticism. It “focuses on teaching how to use software, but gives no insight into how it’s made,” said Eric Schmidt, Google’s chairman (and a director of The Economist’s parent company), in a lecture in 2011. “That is just throwing away [England’s] great computing heritage.”

Digital technology is now so ubiquitous that many think a rounded education requires a grounding in this subject just as much as in biology, chemistry or physics. That is one reason that the pendulum is swinging back towards teaching coding. Employers’ moans are another. The shortage of skilled programmers is clear from the high salaries they command. The shallower the pool of people who know the basics, the smaller the number of potential tech entrepreneurs. According to Judith Gal-Ezer of the Open University of Israel, who was part of the team that put computer science on the country’s high-school curriculum, a growing share of jobs in developed countries require “computational thinking”: the ability to formulate problems in such a way that they can be tackled by computers. But bosses complain that workers lack such skills—and politicians are listening. Mr Schmidt’s public criticism is credited with prodding Britain’s government into action.

In many places, enthusiasts have moved faster than governments. The sorting game described above comes from “Computer Science Unplugged”, a collection of activities compiled by Tim Bell of the University of Canterbury in New Zealand that teach programming concepts using “cards, string, crayons and lots of running around”. Scratch, a simple language created by MIT’s Media Lab, allows youngsters to develop computer games out of on-screen building blocks that have been compared to “virtual Lego”. In America, where computer science features on the regular curriculum in just a tenth of high schools, the Computer Science Teachers Association produces teaching guides and supports several foreign groups, including the one that wrote Britain’s new curriculum.

But the subject is so young that teachers and curriculum designers have little pedagogical research to guide them, says Peter Hubwieser of the Technical University of Munich. How best to explain a concept as abstract as recursion to non-specialists? (Your correspondent has tried several ways, without success.) Which programming language should come first? How to teach mixed-ability groups that will range from self-taught app developers to those who struggle to find the “on” switch?

Even basic matters, such as striking the right balance between conceptual exercises like the sorting game and actually writing programs, are still not settled. Doing some coding is essential, says Michael Kölling, a specialist in computing education at the University of Kent: it motivates pupils and means they find out whether their algorithms work. But should pupils start with programming and leave principles till later, or the other way round?

How a country answers such questions depends partly on what its economy needs. Estonia is short of programmers for its burgeoning tech industry; it puts great emphasis on programming, with some schools teaching it to pupils as young as six. Denmark devotes more time to topics such as the design of user interfaces, which interests its big firms, and the impact of digital technology on society. “We wanted the curriculum to be meaningful for all pupils, not just those who go on to study computer science,” says Michael Caspersen of Aarhus University.

Above all, the new subject will require teachers who know what they are doing. Only a few places take this seriously: Israel has about 1,000 trained computer-science teachers, and Bavaria more than 700. Mathematics and computer-science graduates generally choose more lucrative trades; the humanities and social-science graduates who will find themselves teaching coding will need plenty of support. Britain is skimping: it is introducing its new curriculum in a rush, and preparing teachers has mostly been left to industry groups such as Computing at School, which helped put together the syllabus. If coding is to take its rightful place in the classroom, it cannot be done on the cheap.