It may be hard to swallow the idea that coding could ever be an everyday activity on par with reading and writing in part because it looks so foreign (what’s with all the semicolons and carets)? But remember that it took hundreds of years to settle on the writing conventions we take for granted today: Early spellings of words—Whan that Aprille with his shoures soote—can seem as foreign to modern readers as today’s code snippets do to nonprogrammers. Compared to the thousands of years writing has had to go from notched sticks to glossy magazines, digital technology has, in 60 years, evolved exponentially faster.

Our elementary-school language arts teachers didn’t drill the alphabet into our brains anticipating Facebook or WhatsApp or any of the new ways we now interact with written material. Similarly, exposing today’s third-graders to a dose of code may mean that at 30 they retain enough to ask the right questions of a programmer, working in a language they’ve never seen on a project they could never have imagined.

To produce tech-savvy citizens “at scale,” to borrow an industry term, the heavy lifting will happen in public school classrooms.

ONE DAY LAST YEAR, Neil Fraser, a young software engineer at Google,showed up unannounced at a primary school in the coastal Vietnamese city of Da Nang. Did the school have computer classes, he wanted to know, and could he sit in? A school official glanced at Fraser’s Google business card and led him into a classroom of fifth-graders paired up at PCs while a teacher looked on. What Fraser saw on their screens came as a bit of a shock.

Fraser, who was in Da Nang visiting his girlfriend’s family, works in Google’s education department in Mountain View, teaching JavaScript to new recruits. His interest in computer science education often takes him to high schools around the Bay Area, where he tells students that code is fun and interesting, and learning it can open doors after graduation.

The fifth-graders in Da Nang were doing exercises in Logo, a simple program developed at MIT in the 1970s to introduce children to programming. A turtle-shaped avatar blinked on their screens and the kids fed it simple commands in Logo’s language, making it move around, leaving a colored trail behind. Stars, hexagons, and ovals bloomed on the monitors.

Simple commands in Logo. MIT Media Lab

Fraser, who learned Logo when the program was briefly popular in American elementary schools, recognized the exercise. It was a lesson in loops, a bedrock programming concept in which you tell the machine to do the same thing over and over again, until you get a desired result. “A quick comparison with the United States is in order,” Fraser wrote later in a blog post. At Galileo Academy, San Francisco’s magnet school for science and technology, he’d found juniors in a computer science class struggling with the concept of loops. The fifth-graders in Da Nang had outpaced upperclassmen at one of the Bay Area’s most tech-savvy high schools.

Another visit to an 11th-grade classroom in Ho Chi Minh City revealed students coding their way through a logic puzzle embedded in a digital maze. “After returning to the US, I asked a senior engineer how he’d rank this question on a Google interview,” Fraser wrote. “Without knowing the source of the question, he judged that this would be in the top third.”

Early code education isn’t just happening in Vietnamese schools. Estonia, the birthplace of Skype, rolled out a countrywide programming-centric curriculum for students as young as six in 2012. In September, the United Kingdom will launch a mandatory computing syllabus for all students ages 5 to 16.

Meanwhile, even as US enrollment in almost all other STEM (science, technology, engineering, and math) fields has grown over the last 20 years, computer science has actually lost students, dropping from 25 percent of high school students earning credits in computer science to only 19 percent by 2009, according to the National Center for Education Statistics.

“Our kids are competing with kids from countries that have made computer science education a No. 1 priority,” says Chris Stephenson, the former head of the Computer Science Teachers Association (CSTA). Unlike countries with federally mandated curricula, in the United States computer lesson plans can vary widely between states and even between schools in the same district. “It’s almost like you have to go one school at a time,” Stephenson says. In fact, currently only 20 states and Washington, DC, allow computer science to count toward core graduation requirements in math or science, and not one requires students to take a computer science course to graduate. Nor do the new Common Core standards, a push to make K-12 curricula more uniform across states, include computer science requirements.

It’s no surprise, then, that the AP computer science course is among the College Board’s least popular offerings; last year, almost four times more students tested in geography (114,000) than computer science (31,000). And most kids don’t even get to make that choice; only 17 percent of US high schools that have advanced placement courses do so in CS. It was 20 percent in 2005.

For those who do take an AP computer science class—a yearlong course in Java, which is sort of like teaching cooking by showing how to assemble a KitchenAid—it won’t count toward core graduation requirements in most states. What’s more, many counselors see AP CS as a potential GPA ding, and urge students to load up on known quantities like AP English or US history. “High school kids are overloaded already,” says Joanna Goode, a leading researcher at the University of Oregon’s education department, and making time for courses that don’t count toward anything is a hard sell.

In any case, it’s hard to find anyone to teach these classes. Unlike fields such as English and chemistry, there isn’t a standard path for aspiring CS teachers in grad school or continuing education programs. And thanks to wildly inconsistent certification rules between states, certified CS teachers can get stuck teaching math or library sciences if they move. Meanwhile, software whizzes often find the lure of the startup salary much stronger than the call of the classroom, and anyone who tires of Silicon Valley might find that its “move fast and break things” mantra doesn’t transfer neatly to pedagogy.

And while many kids have mad skills in movie editing or Photoshopping, such talents can lull parents into thinking they’re learning real computing. “We teach our kids how to be consumers of technology, not creators of technology,” notes the NSF’s Cuny.

Or, as Cory Doctorow, an editor of the technology-focused blog Boing Boing, put it in a manifesto titled “Why I Won’t Buy an iPad”: “Buying an iPad for your kids isn’t a means of jump-starting the realization that the world is yours to take apart and reassemble; it’s a way of telling your offspring that even changing the batteries is something you have to leave to the professionals.”

But school administrators know that gleaming banks of shiny new machines go a long way in impressing parents and school boards. Last summer, the Los Angeles Unified School District set aside a billion dollars to buy an iPad for all640,000 children in the district. To pay for the program, the district dipped into school construction bonds. Still, some parents and principals told the Los Angeles Times they were thrilled about it. “It gives us the sense of hope that these kids are being looked after,” said one parent.

Sure, some schools are woefully behind on the hardware equation, but according to a 2010 federal study, only 3 percent of teachers nationwide lacked daily access to a computer in their classroom, and the nationwide ratio of students to school computers was a little more than 5-to-1. As to whether kids have computers at home—that doesn’t seem to make much difference in overall performance, either. A study from the National Bureau of Economic Research reviewed the grades, test scores, homework, and attendance of California 6th- to 10th-graders who were randomly given computers to use at home for the first time. A year later, the study found, nothing happened. Test scores, grades, disciplinary actions, time spent on homework: None of it went up or down—except the kids did log a lot more time playing games.

We’re still in the “scribal stage” of the computer age, where skills are in the hands of an elite.

ONE SUNNY MORNING last summer, 40 Los Angeles teachers sat in a warm classroom at UCLA playing with crayons, flash cards, and Legos. They were students again for a week, at a workshop on how to teach computer science. Which meant that first they had to learn computer science.

The lesson was in binary numbers, or how to write any number using just two digits. “Computers can only talk in ones and zeros,” explained the instructor, a fellow teacher who’d taken the same course. The course is funded by the National Science Foundation, and so is the experimental new blueprint it trains teachers to use, called Exploring Computer Science (ECS). “You gotta talk to them in their language.”

Made sense at first, but when it came to turning the number 1,250 into binary, the class started falling apart. At one table, two female teachers politely endured a long, wrong explanation from an older male colleague. A teacher behind them mumbled, “I don’t get it,” pushed his flash cards away, and counted the minutes to lunchtime. A table of guys in their 30s was loudly sprinting toward an answer, and a minute later the bearded white guy at the head of their table, i.e., the one most resembling a classic programmer, shot his hand up with the answer and an explanation of how he got there: “Basically what you do is, you just turn it into an algorithm.” Blank stares suggested few colleagues knew what an algorithm was—in this case a simple, step-by-step process for turning a number into binary. (The answer, if you’re curious, is 010011100010.)

This lesson—which by the end of the day clicked for most in the class—might seem like most people’s image of CS, but the course these teachers are learning to teach couldn’t look more different from classic AP computer science. Much of what’s taught in ECS is about the why of computer science, not just the how. There are discussions and writing assignments on everything from personal privacy in the age of Big Data to the ethics of robot labor to how data analysis could help curb problems like school bullying. Instead of rote Java learning, it offers lots of logic games and puzzles that put the focus on computing, not computers. In fact, students hardly touch a computer for the first 12 weeks.

“Our curriculum doesn’t lead with programming or code,” says Jane Margolis, a senior researcher at UCLA who helped design the ECS curriculum and whose book Stuck in the Shallow End: Education, Race, and Computing provides much of the theory behind the lesson plans. “There are so many stereotypes associated with coding, and often it doesn’t give the broader picture of what the field is about. The research shows you want to contextualize, show how computer science is relevant to their lives.” ECS lessons ask students to imagine how they’d make use of various algorithms as a chef, or a carpenter, or a teacher, how they could analyze their own snack habits to eat better, and how their city council could use data to create cleaner, safer streets.

The ECS curriculum is now offered to 2,400 students at 31 Los Angeles public high schools and a smattering of schools in other cities, notably Chicago and Washington, DC. Before writing it, Margolis and fellow researchers spent three years visiting schools across the Los Angeles area—overcrowded urban ones and plush suburban ones—to understand why few girls and students of color were taking computer science. At a tony school in West LA that the researchers dubbed “Canyon Charter High,” they noticed students of color traveling long distances to get to school, meaning they couldn’t stick around for techie extracurriculars or to simply hang out with like-minded students.

Equally daunting were the stereotypes. Take Janet, the sole black girl in Canyon’s AP computer science class, who told the researchers she signed up for the course in part “because we [African American females] were so limited in the world, you know, and just being able to be in a class where I can represent who I am and my culture was really important to me.” When she had a hard time keeping up—like most kids in the class—the teacher, a former software developer who, researchers noted, tended to let a few white boys monopolize her attention, pulled Janet aside and suggested she drop the class, explaining that when it comes to computational skills, you either “have it or don’t have it.”

Research shows that girls tend to pull away from STEM subjects—including computer science—around middle school, while rates of boys in these classes stay steady. Fortunately, says Margolis, there’s evidence that tweaking the way computer science is introduced can make a difference. A 2009 study tested various messages about computer science with college-bound teens. It found that explaining how programming skills can be used to “do good”—connect with one’s community, make a difference on big social problems like pollution and health care—reverberated strongly with girls. Far less successful were messages about getting a good job or being “in the driver’s seat” of technological innovation—i.e., the dominant cultural narratives about why anyone would learn to code.

“For me, computer science can be used to implement social change,” says Kim Merino, a self-described “social-justice-obsessed queer Latina nerd history teacher” who decided to take the ECS training a couple of years ago. Now, she teaches the class to middle and high schoolers at the UCLA Community School, an experimental new public K-12 school. “I saw this as a new frontier in the social-justice fight,” she says. “I tell my students, ‘I don’t necessarily want to teach you how to get rich. I want to teach you to be a good citizen.’”

Merino’s father was an aerospace engineer for Lockheed Martin. So you might think adapting to CS would be easy for her. Not quite. Most of the teachers she trained with were men. “Out of seven women, there were two of color. Honestly, I was so scared. But now, I take that to my classroom. At this point my class is half girls, mostly Latina and Korean, and they still come into my class all nervous and intimidated. My job is to get them past all of that, get them excited about all the things they could do in their lives with programming.”

Merino has spent the last four years teaching kids of color growing up in inner cities to imagine what they could do with programming—not as a replacement for, but as part of their dreams of growing up to be doctors or painters or social workers. But Merino’s partner’s gentle ribbings about how they’d ever start a family on a teacher’s salary eventually became less gentle. She just took a job as director of professional development at CodeHS, an educational startup in San Francisco.

“We teach our kids how to be consumers of technology, not creators of technology.”

IT WAS A LITTLE MORE THAN a century ago that literacy became universal in Western Europe and the United States. If computational skills are on the same trajectory, how much are we hurting our economy—and our democracy—by not moving faster to make them universal?

There’s the talent squeeze, for one thing. Going by the number of computer science majors graduating each year, we’re producing less than half of the talent needed to fill the Labor Department’s job projections. Women currently make up 20 percent of the software workforce, blacks and Latinos around 5 percent each. Getting more of them in the computing pipeline is simply good business sense.

It would also create a future for computing that more accurately reflects its past. A female mathematician named Ada Lovelace wrote the first algorithm ever intended to be executed on a machine in 1843. The term “programmer” was used during World War II to describe the women who worked on the world’s first large-scale electronic computer, the ENIAC machine, which used calculus to come up with tables to improve artillery accuracy. In 1949, Rear Adm. Grace Hopper helped develop the UNIVAC, the first general-purpose computer, a.k.a. a mainframe, and in 1959 her work led to the development of COBOL, the first programming language written for commercial use.

Excluding huge swaths of the population also means prematurely killing off untold ideas and innovations that could make everyone’s lives better. Because while the rash of meal delivery and dating apps designed by today’s mostly young, male, urban programmers are no doubt useful, a broader base of talent might produce more for society than a frictionless Saturday night.

And there’s evidence that diverse teams produce better products. A study of 200,000 IT patents found that “patents invented by mixed-gender teams are cited [by other inventors] more often than patents invented by female-only or male-only” teams. The authors suggest one possibility for this finding may be “that gender diversity leads to more innovative research and discovery.” (Similarly, research papers across the sciences that are coauthored by racially diverse teams are more likely to be cited by other researchers than those of all-white teams.)

Fortunately, there’s evidence that girls exposed to very basic programming concepts early in life are more likely to major in computer science in college. That’s why approaches like Margolis’ ECS course, steeped in research on how to get and keep girls and other underrepresented minorities in computer science class, as well as groups like Black Girls Code, which offers affordable code boot camps to school-age girls in places like Detroit and Memphis, may prove appealing to the industry at large.

“Computer science innovation is changing our entire lives, from the professional to the personal, even our free time,” Margolis says. “I want a whole diversity of people sitting at the design table, bringing different sensibilities and values and experiences to this innovation. Asking, ‘Is this good for this world? Not good for the world? What are the implications going to be?’”

We make kids learn about biology, literature, history, and geometry with the promise that navigating the wider world will be easier for their efforts. It’ll be harder and harder not to include computing on that list. Decisions made by a narrow demographic of technocrat elites are already shaping their lives, from privacy and social currency, to career choices and how they spend their free time.

Black Girls Code has introduced more than 1,500 girls to programming. Black Girls Code

Margolis’ program and others like it are a good start toward spreading computational literacy, but they need a tremendous amount of help to scale up to the point where it’s not such a notable loss when a teacher like Kim Merino leaves the profession. What’s needed to make that happen is for people who may never learn a lick of code themselves to help shape the tech revolution the old-fashioned way, through educational reform and funding for schools and volunteer literacy crusades. Otherwise, we’re all doomed—well, most of us, anyway—to be stuck in the Dark Ages.

This story first appeared in Mother Jones magazine.