SAN FRANCISCO -- Silicon Valley companies portray themselves as inventors of the future, but they're afflicted by a longstanding problem.
From board rooms to "brogrammers," men still dominate many corners of the tech industry, where the pantheon of famous founders – from Hewlett and Packard to Jobs to Zuckerberg – is still a boys' bastion.
The gender-imbalance issue came to the forefront again recently when a partner at the country's most prominent venture capital firm filed a sexual harassment lawsuit alleging a former colleague retaliated against her for years after she cut off a brief relationship with him. The firm, Kleiner Perkins Caufield & Byers, has denied the allegations.
Whatever the merits of the claim, the suit again has put a spotlight on the tech industry's gender gap.
To Jocelyn Goldfein, a director of engineering at Facebook, the math is stark.
Less than 20 percent of the bachelor's degrees in computer science go to women, according to federal statistics. By comparison, nearly 60 percent of all bachelor's degrees are awarded to graduating females.
The company wants to hire top engineers, but the talent pool in the U.S. is growing thin, she said. Goldfein said she doesn't look to hire female engineers specifically, just the best people. But she said she'd have a lot more to choose from if women entered computer science at a rate anywhere near the average for all fields.
She blames the lack of role models both in popular culture and in day-to-day life as a key reason for the disparity.
"The reason there aren't more women computer scientists is because there aren't more women computer scientists," she said.
Women in other professions such as medicine and law have become fixtures on television and in movies in recent decades, while portrayals of programmers still tend to follow the hacker stereotype of the lone guy sitting in his basement, she said.
Unless their parents are engineers, girls also aren't likely to encounter coders in their own lives the same way they would, for example, a doctor or a teacher.
"We don't really have that same kind of interaction with software engineers as we go about our daily lives," Goldfein said.
Facebook itself has come under criticism over the lack of diversity on its board of directors, which is composed of seven white men, though the majority of its users are women. At the same time, the company's chief operating officer, former U.S. Treasury Department official Sheryl Sandberg, has become the most prominent female executive in Silicon Valley.
Goldfein said women engineers are also behind many of Facebook's signature features, including the news feed and the photo viewer. She hopes the site itself can serve as a tool to draw more girls and young women into computer science.
"If they realize that when I click on a photo and it pops up, that was made by a woman, think how powerful that would be," Goldfein said.
At gatherings across Silicon Valley, especially those where engineers cluster, lines extend far out the men's room door, while the ladies' room has little wait.
"Sometimes it can be hard," said Serena Yeung, 23, a recent Stanford graduate who worked as a software engineer at a Silicon Valley startup before returning for graduate school. Just walking into the classroom is one of the biggest hurdles for women thinking of entering the field, she said. "You go in and you're the only girl in it."
For Yeung, having parents who were both engineers spared her the sense that computers weren't for girls.
She got her first job as a programmer at Mountain View-based Rockmelt Inc., which makes a Web browser with built-in social media features. She started working there even before she graduated with her degree in electrical engineering, another coding-intensive field where men heavily outnumber women.
Rockmelt CEO Eric Vishria says the competition to hire qualified women software engineers has heated up as companies see that they need diverse perspectives to build products that attract the widest audience. He said startups that don't hire women early in their existence risk creating a male-dominated culture that will put off potential female hires.
"It becomes a death spiral, it becomes self-fulfilling," Vishria said. "You have 15 guys in a room, that's your company, and it becomes harder and harder to hire your first woman."
Yeung said a recent experience at a Stanford Society of Women Engineers event for elementary school students showed her that intervention needs to come early to steer girls toward tech. She said girls who had just come from a computer science workshop complained they didn't like it because the boys asked all the questions.
Steeped in video game culture and barraged by positive male tech industry role models, boys tend to dominate conversations around computing early on, leaving girls feeling shut out, said Yeung.
As for her own childhood, Yeung said that as she got older, her commitment to computing carried a social cost as female friends drifted toward other interests.
"It's harder to spend time with them. It's harder to do things with them," she said. "I think you feel kind of a conflicting pull between friends and career interests. That can be hard."