NASHIK, HOURS BEFORE SHAHI SNAN, the royal bath, an especially auspicious day at the Kumbh Mela. Ten million pilgrims are expected to turn up this year, 25 lakh of them for the holy dip. It’s an unfair burden for the bamboo barricades and police bandobast at one of the most hazardous mass gatherings anywhere in the world. More than 40 people died in fires and stampedes and close to three lakh went missing during the 2013 Allahabad Maha Kumbh. The Haridwar Kumbh of 2010 saw seven stampede deaths and two incidents of drowning. Nearly 40 died in the 2003 Kumbh, again in Nashik. Farther back, the 1954 Kumbh in Allahabad left close to a thousand dead by some estimates. None of this includes the toll taken by assorted infectious diseases at every edition.

A few kilometres from Nashik’s bathing ghats is City Centre Mall. A group of young people with backpacks is making its way to the grand ballroom on the mall’s top floor. Once inside, they take out laptops from their bags and fall into groups.

They will spend the rest of the day writing code.

This is the mission command of Kumbhathon, a weeklong innovation camp run by the Massachusetts Institute of Technology (MIT) in association with, among others, Nashik’s engineering colleges, a couple of IITs, the Maharashtra Police, and a bunch of companies including TCS, Google, and Xerox. Where most see chaos, Kumbhathon’s coders see data. The kind spewed by the behaviour of massive shifting crowds, or germs. The idea is to use the data to unravel urbanisation’s most complex problems. The ultimate goal: “Build multimillion dollar companies” that will solve those problems, and “improve millions of lives”.

In one corner of the room is the team that built Epimetrics, an app that tracks fast-spreading diseases and predicts epidemics. It’s been only a few days since its launch, and the app has already helped the city administration prevent an outbreak of malaria.

Two tables away, the crowd steering team is monitoring heat maps lighting up a Google Maps feed. The maps show the real-time movement of crowds at the Kumbh, data for which is pulled from mobile phone towers in the area. The team passes the data through a visualisation algorithm that converts it into an easy-to-read spectrum from green to red, signifying ‘not crowded’ to ‘chock-a-block’. The police use it to control the flow of people and prevent overcrowding in any one place.

Ingenuity of this kind has its limits; crowd-control tools couldn’t stop the ghastly death of over a thousand during the Hajj last month. But in Nashik, Kumbhathon is helping host the safest Kumbh in years. No one has gone missing. Barring stray reports of drowning, no one has died.

BENGALURU, A SUNDAY MORNING IN EARLY FEBRUARY. Ola, India’s largest cab aggregator, is hosting a 24-hour hackathon in its office. Most of the 200-odd coders are twentysomething men, carrying laptops plastered with Game of Thrones, Incredible Hulk, and Green Lantern stickers. The night before there was unlimited free food and Red Bull, a DJ, even an impromptu birthday party. Now, with hours left, everyone’s manic. The best coders will land jobs in the company that’s said to be worth $5 billion (Rs 31, 585 crore). There are also cash awards.

The brief: Build anything that improves user experience.

Non-coders will be thrown by the vagueness of “build anything”. But if you want to rev up coders, you could think of worse problem statements. Ramesh Raskar, associate professor at MIT Media Labs and one of the brains behind Kumbhathon, would tell you it doesn’t matter whether the task is to prevent stampedes or make cab rides safer, as the Ola hackathon winner set out to do. To code is to change the world. “The biggest cab company in the world doesn’t own cabs. The biggest media company doesn’t own media. People are going to schools without buildings, transacting without cash. Soon they will grow food without farms,” Raskar says. “All this amazing transformation is because of code.”

There’s a profusion of ways in which others have paid tribute to code. Here’s Steve Jobs: “Everyone in this country should learn how to program a computer, because it teaches you how to think.” Tech news portal ReadWrite calls coding “the core skill of the 21st century”. Don’t trust geeks? Take it from former British education secretary Michael Gove, who unleashed the biggest reform in the country’s education system last year by making coding lessons mandatory in schools for kids aged 5 upwards. “Teaching pupils, over and over again, how to word-process, how to work a spreadsheet, how to use programs already creaking into obsolescence [is] about as much use as teaching children to send a telex or travel in a zeppelin,” Gove reasons. “Our new curriculum teaches children how to code ... not just how to work a computer, but ... how to make it work for you.”

Silicon Valley prophet Marc Andreessen sums up the urgency: “Software is eating the world.”

It’s the kind of futurism that feeds the “coders love Star Trek” jokes. Shailesh Nalawadi, former project manager at Google Maps and Streetview and co-founder of Mavin, a company that wants to provide cheap Internet in developing countries, says that’s because Star Trek is coding utopia. “Spock is the prototypical engineer. In his world, you don’t fight for money. You explore for the sake of exploring.” The job and the cash are incidental. The true coder says, I got into this because I can build anything. “Larry [Page] and Sergei [Brin] always asked us to solve the 10X problem,” Nalawadi reminisces. “Don’t improve by 20% or 40%. Make it 10 times better.”

You don’t have to begin with grand visions. Shashank N.D., whose love of code grew into the health-care startup Practo, says all he wanted was “to be part of something that has purpose. I thought it was ridiculous that I could order a pizza in 30 minutes but not monitor my health records online in that time. Someone had to build a smarter algorithm.” Now that he has a business to run, Shashank misses coding. He stays in touch through hackathons, like the one Practo conducted in March. “Congratulations @RahoolGads on kicking ass at Practo Hackathon. A brilliant hack on the Practo Tab. Can’t wait [for] the next hackathon!!” he tweeted afterwards.

That’s not just nerdy excitement: Practo Tab—a device for doctors to manage patient data and spare patients the bother of filling lengthy forms—is one of Shashank’s big bets, the kind that has got investors queuing up for a piece of his seven-year-old company. In a recent funding round, a group led by Chinese behemoth Tencent pumped in $90 million. Ola, which has coded critical new passenger safety features into its app since the February hackathon, is reportedly raising $500 million.

THE DELUGE OF FUNDING FOR TECH STARTUPS may have lionised the coder at the heart of it, but not everyone is chuffed. Bhavin Turakhia, 35, learnt to code when he was 10 and was so good that his teachers were soon taking lessons from him. At 18, Turakhia started a web-hosting business with his brother, which grew into a conglomerate of 13 companies, “all profitable”—without raising a penny by way of funding. Last year, he sold three of the companies to a Nasdaq-listed firm for $160 million. And yet, chances are you’ve never heard of Turakhia or his company Directi in the noise around big bang deals.

So we expect him to be upset when we ask him about the zeitgeist in Indian tech. He is, but not why we thought. “It’s annoying and frustrating that China, Canada, even Poland, beats us year after year,” he says. The reference is to India’s plight in the International Collegiate Programming Contest (ICPC), the world’s oldest and toughest competition for coders. Indian coders have struggled to break into even the top 50.

Turakhia says coding is a life skill in a world where people communicate more with smart devices than with other people. Not everyone needs to be writing complicated algorithms. But if, as Michael Gove says, you want to make technology “work for you”, working knowledge of its lingua franca is a must. “Millions of people are getting access to intelligent and completely programmable devices. If they learn how to maximise their potential, they can fundamentally transform the economy,” argues Turakhia.

Going by the ICPC results though, revolution via coding is a far cry. “Nasscom keeps touting that India is a software powerhouse,” Turakhia says. “There’s no way that can be true if we can’t beat countries 1/20th our size.”

NASSCOM’S CHEST-THUMPING ISN’T BASELESS. India is producing coders like never before. In 2013, California-based market research firm Evans Data Corporation estimated that by 2018, the country will have 5.2 million coders—by far the highest in the world. Rishi Das, CEO of Bengaluru-based recruitment firm HirePro, says India’s population of software professionals has jumped fivefold in the past decade alone, driving a technology and services industry that is on track to hit $225 billion in revenues by 2020 and $350 billion by 2025, per a report by McKinsey and Nasscom. They also fuel the Prime Minister’s catchy marketing campaigns—Digital India and Startup India—which seemingly wowed Valley mavens during his recent tour.

But here are the other numbers you ought to know: Over 90% of Indian computer and IT engineers have poor domain knowledge, says talent development firm Aspiring Minds, meaning that they lack “the ability to apply basic principles of engineering to real-world problems”. Little wonder that not even 2% of the glut of Android apps built in India make it to the top 1,000 globally. That’s actually a benign problem compared with what recruiters have to face: A shocking 3% of India’s engineering graduates are employable (read: job-ready) in IT product roles, less than 8% are fit for design roles, and about 18% for IT services roles (see graphic).

To be sure, warning signs for the Indian software industry began with the slowdown in outsourcing, which can no longer absorb lakhs of coders in low-end testing and maintenance work, leading to oversupply. The legendary cost arbitrage of the Indian coder is also on the wane. Compounding matters is the tidal shift that has IT firms everywhere scurrying: Legacy expenditures—think infrastructure, traditional application development, and packaged software—will see a 20% to 25% cut, as demand soars in newfangled areas like the Internet of Things, analytics, and cloud. “The software market is becoming increasingly crowded as large, multiline firms transform their portfolios to focus more on solutions that have a direct business impact,” says C.P. Gurnani, vice chairman, Nasscom, and CEO and managing director of outsourcing major Tech Mahindra. The upshot: an urgent need to upskill 5 million-odd people.

Aruna Jayanthi, CEO of IT consultant Capgemini India, argues that in terms of pure programming skills, Indian coders are on a par with their global peers. But being competitive today is not only about writing code—“a programmer must be able to visualise how scalable the code is, and in what environments it can operate”. Truly good code is the result of holistic thinking, Jayanthi says.

She finds support in American economist Tyler Cowen, whose book Average Is Over talks about the future of jobs. “Take Mark Zuckerberg who, of course, has been a great programmer,” says Cowen on learning portal “[But] there is much more to Facebook than that. It’s appealing, it gets people to come back, and he was a psychology major. It’s that integration that’s important.”

India’s bias for rote learning and lack of application orientation leave little room for such thinking. “Even when we recruit engineers from the best colleges, it sometimes takes months of retraining before their skills are up to speed. That’s far too long,” says Chandan Chowdhury, former dean (academics) of the National Institute of Industrial Engineering and managing director of Dassault Systèmes India, a subsidiary of the French industrial behemoth. As a contrasting case, Chowdhury tells us the story of his daughter who went to Stanford for a computer science degree. “They were asked to learn a new language and deliver a project in a week,” he recounts. “It’s not about learning a specific language, which will anyway become obsolete. It’s all about learning how to learn.” (For more on the art of learning, click here.)

THERE’S A SENSE OF DÉJÀ VU in any story on India’s ramshackle skill situation. By the government’s own calculation, only 2% of the workforce goes through any kind of formal skills training. The rest turn to jugaad, the peculiar Indian skill of getting by. But the failure to gear up for a whole new world, ruled by specialised software that is expected to do dramatically new things, could be setting India up for its worst-ever skill disaster. What’s scarier: The jingoism around our tech prowess—Indians head Google, Microsoft, and Adobe, after all—could be blinding us to it.

The danger is more than just economic—it’s psychological. The narrative of post-globalisation India relied heavily on its rise as the world’s technology vendor. More recently, the country has been in the throes of an image makeover: a cornucopia of tech startups with Valley-esque aspirations. The degradation of programming skills blows holes in that image (and adds heft to what haters have been saying in anti-outsourcing forums). It also signals a potentially huge missed opportunity: For instance, the U.S. Bureau of Labor Statistics says there will be 1,240,600 programmer jobs by 2022, a 22% jump over 2012—double the growth rate of any other job. The uptake of programming as a career among Americans, on the other hand, is slowing. “The shortage of engineers is a global crisis, and India’s large engineering population could be a big hope,” says Naomi Climer, president of British industry body Institution of Engineering and Technology, “provided there is committed focus on quality and professional standards.”

For the media, the quality of coders is far too abstract a subject compared with funding or valuation. But from time to time, the malady outs itself. In May, Snapdeal co-founder Rohit Bansal spoke to the Wall Street Journal about the company’s travails with local programming talent. Flipkart’s Sachin Bansal tore into him on Twitter: “Don’t blame India for your failure to hire great engineers.” The episode was a cue for the tech press to start a meaningful debate, but few went beyond bluster.

Meanwhile, at least one aspect of the market speaks to Rohit Bansal’s point: Salaries for employable coders have gone through the roof. Peeyush Ranjan, Flipkart’s chief technology officer and head of engineering, gives it the usual “investment in talent” spin. Shashank of Practo acknowledges spiralling wages but says it is only fair. “Coders have been underappreciated. If you are writing products that can change the world, you better be paid for it.” Even legacy companies not known to be generous paymasters have had to increase pay for freshers, and keeping up is becoming onerous if you don’t have access to big money, says a Bengaluru-based early-stage entrepreneur.

Britain introduced coding to kids who can barely spell, partly as a response to tech firms spooked by the talent crunch. We ask Geoff Smith, head teacher of Kehelland Village School in Cornwall, what schools are making of it. There are big challenges, Smith says. The curriculum isn’t based on the latest industry practices, teachers are at sea, and infrastructure is a concern. But the policy “will hopefully leave children with skills that will be valued in the industry. Children also seem to take pride in the coding projects they have completed,” Smith adds.

Codecademy, an American startup that is helping British schools build capacity, calls it a visionary move. “Change can be frightening,” the company’s 25-year-old CEO Zach Sims tells us over Skype. “But if you think of coding as the backbone of the modern economy, the return on investment is huge. Even if all those kids don’t become programmers, problem solving through coding can make them better at whatever they choose.”

In India’s schools, computers occupy a limbo. “Most parents are fixated with making their children software engineers. We are forever talking about software being the future. But our education boards relegate computers to just another elective,” says Arghya Banerjee, an IIT-Kharagpur and IIM-Ahmedabad graduate who founded The Levelfield School under the Central Board of Secondary Education (CBSE) in Suri, a tier III town in West Bengal. Data from code-learning and competition platform HackerRank shows that a little over 20% of CBSE students at the Class 12 level opt for either of the two electives, Computer Science or Informatics Practices, with an overwhelming absence of non-science students. (In a rare piece of good news for diversity votaries, the number of Indian women enrolling for computer science courses at the college level has been inching up, but that’s the subject for another story.)

The lack of preparation hurts industry. “We recruit people from different streams, not just computer science, and sometimes we find that the fundamentals are not very strong with people from these other streams,” says Jayanthi of Capgemini India. Compulsory computer lessons at the primary level, before a kid is pigeonholed in ‘science’, ‘commerce’, or ‘humanities’ silos, is one way to correct this, but that isn’t even a conversation. To break free, Banerjee’s school, which has won awards for its focus on skill building, is thinking of dumping CBSE and enlisting under an international board.

MATCHING STEP WITH technological disruption is a hairy problem for most governments. India has the right person for the job: The guardian bodies for skill development in the country—the National Skill Development Corporation (NSDC) and the National Skill Development Agency (NSDA)—are chaired by S. Ramadorai, former CEO of TCS, India’s No. 1 software firm. “Programming is a fundamental skill for everything from industrial prototypes to cybersecurity, and you have to start in school,” Ramadorai agrees. “But we can’t copy-paste solutions from elsewhere without ensuring critical infrastructure like broadband.” The hope is that kids will train themselves once they are given the infrastructure. “These days there are so many online tutors. Not all learning needs a classroom,” Ramadorai says.

What about making programming a part of the skill development framework, often accused of being stuck with old-world technical skills? “In all honesty, things are still in the early awareness stage,” he says.

NSDC’s managing director and CEO Dilip Chenoy says programming is only one piece of the puzzle. “More critically, we need to train people on using what the programmers build, from smart grids to smart homes to smart cars.” That also means upskilling vast numbers of professionals—electricians, plumbers, mechanics—who were the product of a blue-collared paradigm of skilling and may find themselves left out in the cold.

The private sector is getting a move on. Turakhia, for instance, funds CodeChef, which he claims is India’s largest code contest website. In five years, CodeChef has signed up over 2 lakh users who have submitted 6.5 million solutions to all sorts of challenges. Now Turakhia wants to make CodeChef part of the curriculum in colleges. The plan is to run a year-round skill assessment programme in the college and score students at the end of the year. The college can convert that score into credits. “We tell them that students with better algorithmic skills end up earning four to five times more than the rest. The good news is, anyone can get better at it, just like languages or math. Colleges have been very receptive,” he says.

Then days before we went to press, American online education company Udacity, founded by Stanford professor and the inventor of the autonomous car, Sebastian Thrun, announced that it will bring its Nanodegree courses in Android development to India in partnership with Google and Tata Trust. This is Udacity’s first overseas venture.

What will help such programmes gain momentum among people from all backgrounds is programming itself getting less geeky. “The last few languages that have been launched read like English,” points out Harishankaran K, co-founder of HackerRank.

HackerRank also represents the growing breed of coder-discovery platforms that help companies locate talent. The premise: Many coders are self-starters who may not be found through traditional recruitment channels. “Also, pen-and-paper tests don’t work here”, says Hari. “A resume can only state that this person knows Java, it doesn’t tell you how good and clean the code is.” HackerRank has placed coders in companies like Facebook and Palantir and raised some $20 million for its troubles.

BUT WHAT IF THE FUSS AROUND CODERS in idealistic startups is just selection bias? Where’s code in our primordial industries, we ask Chowdhury of Dassault. Couple of months ago, Chowdhury had visited the Fortune India office to showcase Dassault’s 3D technologies. The pièce de résistance was the Living Heart, a giant 3D simulation of the human heart. Doctors can walk inside it, study and predict problems, and prescribe personalised treatments. Dassault says this kind of computational modelling is the future of medicine and the end of luck and intuition. Now, Chowdhury tells us about a different world where luck and intuition loom large: mines.

Most mine owners are clueless about the capacity of their mines or the quality of their reserves, because mines, typically located in remote areas, offer terrible visibility, Chowdhury says. “Worse, many miners don’t know the boundaries underground and get into trouble for encroachment.” That’s when they get caught. When they don’t, it costs the country thousands of crores. Ask the Shah Commission, which is investigating rampant illegal mining across states.

In spite of the mess, which has led to the industry being portrayed as “lawless” and “out of control”, mine owners have had it good. Labour is dirt cheap. Prices were on steroids. “Most of them would be happy to spend millions on earth-moving machines rather than efficiency-enhancing software,” says Chowdhury. But then came the crash in prices and the slowdown in China. Suddenly, everyone is chasing efficiency. Dassault has just the thing: 3D, of course.

“Imagine if you could make a mine completely transparent. You could see exactly how much coal you have, and of what quality. You could predict safety issues—before you build the mine. You could avoid breaking laws. Imagine how that could transform the industry.”

The pitch is working. The who’s who of the trade, from Tata Steel, NTPC, and Reliance, to Lafarge, ACC, and UltraTech, are clients of Dassault’s mining software, Surpac for iron ore and Minex for coal. The company’s Indian R&D team, which forms the majority of its 2,000 employees here, plays a key role in such projects, cutting through one of our last dark industries. “Modelling mines is the start.

Someday our programmers will model the planet,” Chowdhury tells us. “Imagine that.”

Follow us on Facebook, X, YouTube, Instagram and WhatsApp to never miss an update from Fortune India. To buy a copy, visit Amazon.