The United States has produced viable female presidential candidates, women athletes who command millions of dollars in endorsements, and the first female Nobel economist. Yet there is still no female equivalent of a Steve Jobs, Bill Gates or Mark Zuckerberg. Women continue to lag behind men in computer science, where their share of the workforce has actually declined over the past 25 years. Today, women hold 27 percent of all computer science jobs, down from 30 percent a decade ago, and account for just 20 percent of undergraduate computer majors, down from 36 percent in 1986.

The tech gap begins at home, where boys get their first computers and video game consoles at a younger age than girls and are more likely to play with toys that build spatial reasoning skills, like Lego. It continues in schools, where female students voice less confidence in math, science and computing, and it persists in the corporate world. Even among the younger generation of tech companies, including Facebook, Google and Twitter, fewer than 10 percent of all computer programmers -- the field's core job -- are women, according to industry insiders.

The effects of this gender gap reach far beyond whether women are building video games or coding Web apps alongside men (and making technology female-friendly -- remember the Siri/abortion flap? Or the more recent dust-up over Asus' leering tweet?). Over the past 10 years, three times as many jobs have been created in STEM fields -- science, technology, engineering and math -- than in non-STEM fields, and STEM workers have been far less likely to experience unemployment. Women who work in STEM also earn more than other female workers: an average of $31.11 an hour, compared with $19.26 for non-STEM women. The wage gap between the genders is also smaller in STEM fields, just 14 percent, compared with the 21 percent difference between men's and women's earning powers in the rest of the workforce.

Economists expect those trends to continue over the coming decade. And if American women can't step up to meet the growing demand, our foreign competitors will. Brazil, India and Malaysia are among the rising powers that have much more successfully prepared girls to enter computer science.

Sheryl Sandberg, the chief operating officer of Facebook, calls the fight to attract girls and young women to high-tech careers "our generation's major frontier for equal outcomes for women." And Sandberg has a counterintuitive suggestion for how to close that gap: "Let your daughters play video games. Encourage your daughters to play video games!" she told me in an interview last fall.

Although most parents would do anything to prevent their children from spending all day in front of a screen playing games, childhood gaming and hacking experience has motivated many computer programmers to enter the field, including Sandberg's boss, Facebook founder Mark Zuckerberg.

The leap toward more advanced computing comes not only from playing games -- today, 94 percent of girls are gaming, compared with 99 percent of boys -- but in becoming curious about how they work and then beginning to tinker with code in order to modify game results. Boys are still much more likely than girls to explore this type of simple computer programming, and not every young girl who is curious about how computers work has an encouraging parent at home or the hardware she needs.

So what can schools do to encourage girls in this direction? In 2005 the computer science faculty at Harvey Mudd College in Claremont, Calif., decided to launch a major effort to attract first-year women to computer programming courses and keep them there.

Professors noticed that men seemed to arrive in even the most rudimentary computer science classes with pre-existing programming knowledge -- often acquired informally through online coding forums -- that intimidated less experienced students. So they split the introductory course into two sections: one for true neophytes (who are more likely to be female), the other for those who had tinkered with programming in the past.

Harvey Mudd also launched a summer computer science research internship for 10 female rising sophomores annually and began taking dozens of women computer students each year to the Grace Hopper Celebration of Women in Computing, where they get face time with professional mentors from companies like Cisco and IBM. Since Harvey Mudd launched these initiatives, the computer science program has grown from 31 percent to 42 percent female. Companies like Microsoft, Google, Facebook, HP and Yelp have flooded the campus during recruiting season in a frantic search for female programmers.

K-12 educators, too, know the importance of getting girls hooked on the kind of "computational thinking" that makes programming possible. The Academy for Software Engineering, a public school whose curriculum will be built around computer programming and Web development, will open in New York City this September. Just one-quarter of the incoming freshman class is female, but the school's founders, who are closely tied to the New York tech community, have ambitious plans for pairing female students with women mentors working in the field, to tamp down on attrition, direct girls into meaningful careers and recruit more female students to the school in future classes.

In Pajara Valley, Calif., south of Santa Cruz, researcher Jill Denner launched a program that teaches low-income Latina girls and boys, in gender-segregated classrooms, to create their own computer games.

Laura Reasoner Jones, a computer teacher at McNair Elementary School in Fairfax County, Va., launched the GEMS Club: Girls Excelling in Math and Science. The club is an afterschool program that gets girls busy building rockets, studying strawberry DNA, and programming their own computer games using free Web-based tools such as ALICE, developed at Carnegie Mellon University, and SCRATCH, developed by MIT.