CLAREMONT, Calif. — When Maria Klawe became president of Harvey Mudd College in 2006, she was dismayed — but not surprised — at how few women were majoring in computer science.
A mathematician and computer scientist herself, she arrived at Harvey Mudd (the smallest of the five so-called Claremont Colleges) in the midst of a nationwide downturn for women in computer science. As recently as 1985, 37 percent of graduates in the field were women; by 2005 it was down to 22 percent, and sinking.
And the situation at Mudd was even grimmer. Of the college’s 750 students, about a third were women (the figure is now closer to half), but for years the percentage of computer science graduates had been hovering around the single digits.
How Dr. Klawe (pronounced KLAH-vay) and her faculty turned things around — this year, nearly 40 percent of Harvey Mudd’s computer science degrees will go to women — sheds light on a gender gap that elsewhere remains stubbornly resistant to changing times.
Thanks in part to companies like Facebook, Yelp and Zynga and in part to cultural sensations like the movie “The Social Network,” coders are hip and computer science is hot. Departments across the nation are brimming with students.
But those students are overwhelmingly male. In 2010, just 18.2 percent of undergraduates in the field were women, according to the National Center for Education Statistics — in spite of gains in chemistry, biomechanical engineering and other so-called STEM fields (the acronym stands for science, technology, engineering and mathematics).
“It must be the unique area of science and technology where women have made negative progress,” said Nicholas Pippenger, a mathematics professor at Harvey Mudd, who is married to Dr. Klawe.
Dr. Klawe and others say the underrepresentation of women in the field is detrimental in a larger sense. Computer science, they say, is as vital to propelling society forward in the digital era as mechanical engineering was in the industrial age.
“If we’re not getting more women to be part of that, it’s just nuts,” Dr. Klawe said. At Mudd, she continued, “we’re graduating 20 female computer science majors a year, and every one of them is a gem.” In 2005, the year before Dr. Klawe arrived, a group of faculty members embarked on a full makeover of the introductory computer science course, a requirement at Mudd.
Known as CS 5, the course focused on hard-core programming, appealing to a particular kind of student — young men, already seasoned programmers, who dominated the class. This only reinforced the women’s sense that computer science was for geeky know-it-alls.
“Most of the female students were unwilling to go on in computer science because of the stereotypes they had grown up with,” said Zachary Dodds, a computer scientist at Mudd. “We realized we were helping perpetuate that by teaching such a standard course.”
To reduce the intimidation factor, the course was divided into two sections — “gold,” for those with no prior experience, and “black” for everyone else. Java, a notoriously opaque programming language, was replaced by a more accessible language called Python. And the focus of the course changed to computational approaches to solving problems across science.
“We realized that we needed to show students computer science is not all about programming,” said Ran Libeskind-Hadas, chairman of the department. “It has intellectual depth and connections to other disciplines.”
Dr. Klawe supported the cause wholeheartedly, and provided money from the college for every female freshman to travel to the annual Grace Hopper conference, named after a pioneering programmer. The conference, where freshmen are surrounded by female role models, has inspired many a first-year “Mudder” to explore computer science more seriously.
The topic of women in computing was a preoccupation for Dr. Klawe well before she took over at Harvey Mudd, in part because when she chose her profession, women in male-dominated fields were especially rare.
“She was consistently told by teachers in adolescence, then later by colleagues, that the things she was interested in were things women didn’t do, and that there were no good female mathematicians,” Dr. Pippenger said.
Dr. Klawe persevered. A native Canadian, she received her Ph.D. in mathematics in 1977 from the University of Alberta. She started a second Ph.D., in computer science, at the University of Toronto, but was offered a faculty position there before completing the degree.
In 1980, she married Dr. Pippenger, a highly regarded theoretical computer scientist, and for the first decade of their marriage Dr. Klawe was the professional afterthought. In the 1980s, they both worked at the I.B.M. Almaden Research Center in San Jose, Calif. “They only hired me so they wouldn’t lose Nick,” Dr. Klawe said.
They moved to the University of British Columbia in Vancouver in 1988, and Dr. Klawe’s talents as an administrator began to blossom. In 2002, she was recruited to Princeton University as dean of engineering and applied sciences.
“By the time we went to Princeton,” Dr. Pippenger said, “it was clear they were hiring me because they really wanted to get Maria.” Dr. Klawe, a slight and sprightly woman, had not been at Princeton long before she began receiving recruiting inquiries. “If you’re a female administrator at a place like Princeton, you’ll get a request to be president or provost twice a week,” she said. “A lot of times it’s not that they care about you, but they need a credible female candidate.”
She seldom read beyond the first few lines. “I had this automatic message saying I was honored to be nominated, but had no intention of leaving Princeton in the near future,” she said.
Then one day in 2005, an announcement about the search for a president at Harvey Mudd floated into her in-box. She knew about the college and couldn’t resist opening the attachment.
“I read it and thought, ‘Oh, my God, the person they’re talking about for this job is exactly me,’ ” she said.
Soon after arriving at Mudd, she gathered the school’s extended community to help formulate a long-term strategic vision. “She shut down the school for four days,” said Robert Cave, vice president for academic affairs. “She said, ‘I want the entire community to be involved in charting the course of Harvey Mudd for the next 10 years.’ ”
In her third year on the job, Dr. Klawe landed the largest single contribution in the college’s 57-year history — $25 million from R. Michael Shanahan, a financier and the former chairman of Mudd’s board, who has since given an additional $6 million.
Now 60, Dr. Klawe is most often seen on campus in jeans — even, sometimes, on a skateboard, a skill she taught herself in just the last few years. (“We would all really worry if she didn’t wear her protective gear,” Dr. Cave said.)
Her leadership style is equally informal, and it has taken some of the faculty by surprise. Professor Libeskind-Hadas recalled that at one of the first full faculty meetings, she spoke while sitting on a table in front of the room.
In a nod to Mudd’s very personal character, Dr. Klawe said, every summer she uses a flash card program to memorize the names of the nearly 200 incoming freshmen. On campus, she greets each student she passes by name. When the occasional prankster tries to stump her by presenting her with a non-Mudder, “usually I can figure it out,” she said, “but not always.”
She is an inveterate booster and recruiter for Harvey Mudd. On planes and ski lifts, at conferences and in far-flung restaurants, she often wears a T-shirt reading, “The Most Amazing School You’ve Never Heard Of.” (The answer is on the back. Harvey Mudd, by the way, was a mining magnate in the first half of the 20th century.)
Efforts like these are bearing fruit. More high school seniors than ever are applying to Harvey Mudd. The college now accepts just 17 percent of applicants, and routinely snatches high school seniors who might otherwise choose better-known institutions like the Massachusetts Institute of Technology and Carnegie Mellon.
Dr. Klawe sometimes does the recruiting herself, sending personal messages to fence-sitters. “You tell her about a kid you really want and within four seconds, she’s sent an e-mail,” said Thyra Briggs, Mudd’s vice president for admission and financial aid.
Dr. Klawe and others speak of “converting” female students to computer science. The idea, they say, is to make the introductory course enjoyable and interesting enough that women who were thinking of other majors choose computer science instead.
Bridgette Eichelberger, a sophomore, is one such convert. She entered Mudd interested in engineering, only to switch computer science after taking CS 5.
“I’m in my required engineering course now, and it’s fun,” she said. “But it’s nothing like the happiness I’ve been getting from C.S. courses.” She has a job lined up for the summer, working for Microsoft.
“If she had missed computer science, it would have been a missed opportunity for both sides,” Professor Dodds said.
Whether Mudd’s success can be replicated on a broad scale is unclear. Only a handful of colleges make computer science a requirement, which creates built-in exposure to the subject. And with fewer than 100 female freshmen, Mudd can afford to send all of them to the Hopper conference.
Still, signs of progress dot the higher education landscape.
At Carnegie Mellon, the percentage of incoming women enrolled in the computer science program has been rising since 2008, and is at 32 percent. M.I.T.’s figure is 30 percent. “Close to 50 percent of our undergraduates are women,” said Barbara Liskov, a computer scientist there. “So having 30 percent is nice, and better than it used to be, but not as good as you might hope for.”
The University of California, Berkeley, and a few other universities have also redesigned their computer science courses to be less intimidating. The Berkeley course aimed at nonmajors is called “The Beauty and Joy of Computing.” Brian Harvey, a computer scientist there, said half the students who finish the course go on to take the course for majors. “We are 150 students per semester and climbing,” he said, adding that half the students are women and women do as well as the men.
Bucknell University, in Lewisburg, Pa., recently adopted the “gold” version of Mudd’s CS 5 course in its entirety.
Stanford is also working to make computer science more attractive to women. “What Harvey Mudd has done is super,” said Stephen Cooper, a computer scientist there. “What other schools need to do is take a serious look at what works for their own environment.”
Despite the success at her own campus, Dr. Klawe continues her crusade to lift the numbers. She visits other universities and corporations to give advice on recruiting women to STEM careers — and retaining them. Often she reminds her audience that for much of her career she felt like an impostor.
Jennifer Tour Chayes, a friend of Dr. Klawe’s who is managing director of Microsoft Research New England, in Cambridge, Mass., says that is an important lesson.
“Women are often questioned, and then they take the impostor syndrome as their inner voice, as proof they shouldn’t go on,” she said. “What they need to know is that women like Maria also had that inner voice, and luckily they went on, and look how they’re doing.”
In spite of unequivocal evidence to the contrary, Dr. Klawe still has moments when she is convinced she is an impostor.
“If you’re constantly pushing yourself, and putting yourself in new environments, you’ll feel it over and over again,” she said. “So the only really important thing is not to let it stop you.”
A version of this article appeared in print on April 3, 2012, on page D1 of the New York edition with the headline: Giving Women the Access Code.