On a rainy lunchtime at West Auckland's Marina View School students hold their breath as a robot enters the shade beneath a chair. Passing a leg it turns hard right and sets off across the room. Students watch as if tracking a golf putt.
There are groans as the machine drifts to the right, and laughter as its mission ends farcically, running over a stray keyboard. Rapid debate follows on how to amend instructions to the robot so it reaches its destination.
Andrew Busch and Aakash Singh, both 11, huddle over a laptop and alter the digital code they have written to programme their machine.
In simple terms, the computer code is a version of a "four steps forward, turn right, five steps forward" command - although the lesson is deliberately not that straightforward.
"We need to estimate how much it would need to go through the chair," says Andrew. "Because every robot has its own measuring scale," adds Aakash.
The two friends, who started to code only in May, say they sometimes use a metre ruler as a scale - a way to figure out how the "robot units" relate to actual distance.
They and their classmates also do more complex tasks, such as adding a sensor to the robot that follows a black line or light.
At Marina View School children as young as 7 are programming, making them among the youngest in the country to be learning such skills - but it's a feat that will soon be ordinary by some international standards.
This month a new computing curriculum was introduced in England, with all primary school children learning about algorithms and computational thinking. A similar move in Australia was planned for the start of next year, but a recent curriculum review by Federal Education Minister Christopher Pyne has put it in doubt.
The compulsory option is hailed by those who see coding as the "new literacy" - a skill that will unlock the prosperous jobs of the future.
Many of those jobs have already arrived, and companies here can't find Kiwis with the skills to fill them.
"I can just see this gap between what kids in New Zealand are currently learning and where the world is going," says Grant Straker, founder and chief executive of Straker Translations. The company emerged from Straker Interactive, which developed multilingual content management systems.
Mr Straker employs eight developers at the Albany-based company, only one of whom is New Zealand-born. Some of the others, from countries including Nepal, India and Japan, are largely self-taught.
"One of the big issues for education in the future is that so many in poorer countries can self-educate and get very relevant skills in online courses," Mr Straker says. "Coding is one example but there are others."
A board of trustees member at Whangaparaoa Primary School, where his own 7 and 9-year-old attend, Mr Straker has started a programme this term in which a handful of students visit his offices to learn coding.
He believes those industry-school partnerships, with enough government backing, could eventually help address the skills shortage.
The biggest players in technology are already on board. Microsoft and Google are among those who have helped set up online courses for students, and support for teachers.
But is the hype justified? In Britain, critics have questioned the value of teaching programming to all children, given only a handful will likely end up as professional programmers.
For Professor Tim Bell of the University of Canterbury, who is involved in efforts to train more teachers to understand computer science, such criticisms largely miss the point.
"Generally people have the wrong idea about what's involved in computer science software engineering, and particularly the image that it's just sitting at a computer typing away," Professor Bell says.
"Really there is way more to it than that. Most professional software engineers would probably only spend 20 per cent of their time programming. Because most of it is about communication with people - finding out what people need, and then designing something that will meet that need."
For example, it's relatively easy to write the programme that would tell a search engine to scan every web page in the world, Professor Bell says.
The (lucrative) challenge - which takes creativity and the ability to problem-solve - is to make that search take a fraction of a second, and produce the most relevant results.
"Computer science is as much about programming as astronomy is about telescopes. Astronomers need telescopes and they spend all their time working with telescopes. But it is not the point."
The failure to understand what computer science involves is not new. More than 22 years ago, Professor Bell was asked to explain the discipline to a group of primary school children.
That task led to his widely hailed Computer Science Unplugged project, which teaches computing concepts using objects such as cards, string and crayons, and plenty of physical activity.
The free programme is now used around the world and has been translated into several languages.
Research shows that children need to have some experience of computer science before the age of 12, Professor Bell says, after which "their views and opinions of their own abilities start settling in".
That was particularly true for girls. Computer science is viewed by many as a largely male discipline, despite the fact women tend to do better at school and university.
Because scientific concepts are taught at school, even young children have some idea of what is involved in being a scientist, Professor Bell says.
"But if you ask them about this career where there is many, many jobs going begging, they can't even articulate what would be involved.
"Having it as a school subject is partly to prepare them, but actually I think the most value is figuring out if they'd like to do it."
Dr Craig Nevill-Manning, Google's Blenheim-raised engineering director who founded its first remote engineering centre in New York, agrees.
People equate difficult mathematics with computer science and being a software engineer, but the "dirty little secret" is the maths is not very difficult, he says.
"It's looking at a problem and figuring out how to attack that problem and come up with a solution - that's really the core of computer science," says Dr Nevill-Manning, who oversaw the development of Google Maps and Google Finance.
"That gets lost a little bit in the story. So the people who tend to opt into computer science at university are probably a little on the nerdier side - the maths geeks and so on - but I think what we desperately need at Google is a bigger diversity of people. Diversity of gender, for example."
Asked if computer science will increasingly become part of other "non-tech" jobs, Dr Nevill-Manning says it's already happened. Google recently participated in a study that found in New York most tech jobs were in non-tech businesses.
"I don't think we need to go out on a limb and make predictions. The world we live in right now has a huge requirement for these skills."
In 2011 New Zealand was the first English-speaking country to introduce computer science into secondary schools. Our example was studied by England in the lead-in to its own reforms, which have gone further in mandating lessons at the primary level.
Professor Bell says the difficulty facing all countries is ensuring teachers and school leaders understand and embrace what is a totally new subject.
The concepts and type of thinking involved in computer science could be integrated into existing subjects and lessons - provided teachers were given enough training and support. Without that, Professor Bell says, making it compulsory could be counterproductive.
Gerard MacManus, head of technology at St Bede's College in Christchurch and president of the NZ digital tech teachers association, says the biggest barrier to teacher training is a lack of government investment.
He says 176 out of the roughly 426 secondary schools in the country have taken up the opportunity to teach the achievement standard in programming at NCEA Level 1.
Funding for professional development could bring more schools, and students, on board, he says. Teaching colleges also need to promote computer science, so new teachers can spread knowledge and advocacy.
Education Minister Hekia Parata says about $75 million is invested in teacher professional development, including supporting them use digital technology in the classroom.
An expert reference group is also working to provide advice to help ensure schools make the best use of modern technology, underpinned by the $211 million spent on rolling out high-speed internet to schools.
"A lot's changed in digital technology since the curriculum was introduced so we are addressing that. We're reviewing how we support digital technology in the curriculum," Ms Parata says.
"The review brings together a whole range of experts to look at how we strengthen kids' learning of digital technology and covers the curriculum at all levels."
Some schools that have embraced coding and computer science are already seeing benefits for their students.
A recent St Bede's graduate, among the first in the country to complete three years of computer science NCEA, landed a job at a real estate agency, partly because of his digital ability.
"He has recreated their website, and he is also going through and doing a security audit for the business because he found that he could access the director's details and files," Mr MacManus says.
Brent Lewis, principal at Auckland's Avondale College, is taking legal advice on how to protect the intellectual property of students designing apps as part of their school work.
The college has created an Innovation Programme and has students who recently topped a Microsoft ICT competition, and then went on to place internationally.
Auckland Chamber of Commerce chief executive Michael Barnett is among those expressing interest in what the school is doing.
"We are trying to get legal advice on creating standard contracts to protect the IP for the kids, so they don't get done over when they enter the market place," Mr Lewis said.
He says technological change means "by the time the curriculum is written the market has moved on".
For that reason, the school focuses on app creation.
"Coding is critical but, really, do you want to study coding with no context? That's tedious, it would drive you nuts. But if you know why you're doing it ... bring it on."
New coders start here
Why all the fuss?
Coding has been called the "new literacy" because of its role in powering our digital world. Websites, apps, computer programmes and everyday objects like microwaves rely on code to operate.
People in jobs not directly linked to computer sciences will still benefit from an understanding of programming and coding.
Put simply, it is telling a computer what you want it to do by typing step-by-step commands. There are many different coding languages.
How do you get started?
Some primary schools are already teaching coding and computer science. Other organisations, such as Code Club Aotearoa, run after-school programmes. There are also a huge number of online resources.
At code.org, the basic concepts of computer science are taught with drag and drop programming. Video lectures star Bill Gates (Microsoft), Mark Zuckerberg (Facebook), Angry Birds and Plants vs Zombies.