The Joy of Teaching Computer Science in the Age of Facebook

"When people see companies like Google and Facebook being founded by relatively young people, they feel empowered and think: I can do that."

Jay LaPrete/AP Photo

Over the last two decades, it can be argued, no area of study has seen larger growth in span and general application than computer science. Today, computer science encompasses everything from bio-statistics to computer animation to start-ups. Mehran Sahami, a professor and Associate Chair for Education in Computer Science at Stanford University (where he earned both his undergrad degree and Ph.D.) has loved computers since he was ten years old. I spoke with Professor Sahami about the changes he’s seen in the field since he first started studying computer science, his time working at Google (before the rest of us knew what “googling” was), and whether computer science is for everyone.

How is computer science taught differently today than it was when you were a kid?

Students who take computer science classes are more aware of the uses of computing. When I was a kid, the average person didn’t have a computer in their house, and there certainly was no Internet browsing. Now, it’s such an integral part of what people do on a daily basis. You see students who are consumers of technology coming into those classes. They’re more aware of what’s possible, but the real magic is turning students from consumers of technology to potential producers of technology.

So many high schools today still don’t offer computer science.

One in ten schools have an AP computer science class. But the statistics about which schools offer any computer science class are harder to come by, because the real question is, what do you count as a computer science class? Some schools may have a course in how to use a word processor and a spreadsheet, and call that a computer science class, whereas other schools offer real programming classes and call it a computer science class.

Right. In New York State, computer science isn’t even viewed as an official subject. Do you see this as a problem?

If kids don’t have access to computing education, it’s a serious problem. There are many jobs available in computing—the Bureau of Labor Statistics predicts that we’re under-producing people with computer skills by a factor of three-to-one. So students who don’t have the opportunities to learn about computing to see if this is something they’re interested in, at an early stage, are losing out on the opportunity to pursue these careers, which are in high demand.

You went to undergrad at Stanford, got your Ph.D. there, and now teach there. What was Stanford like when you were a student?

When I was an undergrad in the late ‘80s, early ‘90s, there wasn’t as much general awareness of the kinds of things you can do with computing. There wasn’t the same level of intensity in the high-tech economy that there is now. So the notion of people going to do start-up companies was a very foreign concept. Most people were in computer science not because they were aware of the job opportunities. If anything, they heard stories about IBM having their first layoffs ever, and other negative information. They got into it because they were really interested and loved the technology. At the time, there was one large monolithic set of requirements for everyone doing a computer science major.

If you fast-forward 25 years, the perception and the opportunities have changed. In terms of opportunities, computing is a field that’s gotten much larger. There are many more sub-areas of computer science like graphics and human-computer interaction and computational biology that we want students to get exposure to. The undergraduate program there now, instead of having one set of requirements for everyone, has a set of tracks by area of concentration. There’s a core that all students share, but depending on which track they’re in, they work in different areas. That casts a broader net for students. There may be some students who have a serious interest in a particular area of computing and want to focus on that, so having this flexibility in the program brings in people who might be interested in film and computer-animated movies that wouldn’t necessarily see computer science as the path to there before. Now they can concentrate in graphics, and not only get a rigorous computer science education, but learn about how to do graphics and animations.

So the idea of what is possible has expanded.

It’s expanded, and we also have multi-disciplinary options where there are classes from other fields that can count towards computer science when we think they make sense. For example, we have a track in bio-computation where we actually count a fair amount of chemistry and biology towards a computer science degree. We think that the people who will be leaders in computational biology need not just an understanding of computation, but also need to understand the biology.

In your Tedx Talk at Gunn High School you mention that from 2000 to  2005 the number of students enrolling in computer science dropped significantly. What happened?

The clear factor for this was the dot-com bubble bursting. If you look at the high-tech economy up until that point, starting in 1995 when Netscape has its initial public offering, there is this frenzy around the Internet. The stock market goes crazy, lots of people are doing start-ups, and as a result, a large number of students begin to think of computing as not just something to do because you’re interested in technology, but as something you potentially do to get rich. In mid-2000, the dot-com bubble bursts, the high-tech economy crashes, a lot of the start-ups go out of business, and not only do the students who thought this was the way to get rich leave computing, but even the ones who were interested in technology think that maybe there aren’t any career opportunities. So you couple this economic downfall with the news coming out about the tech jobs moving offshore to China and India, and that further creates this perception in the United States, at least, that there aren’t going to be as many high-tech jobs in the future. That’s a deterrent for students who may have been interested in going into computing.

Was this decline in enrollment a factor behind Stanford’s decision to redesign the computer science curriculum in 2007?

It’s a combination of factors. The drop-off made us aware that there were some larger issues going on. It’s not that we thought our curriculum was broken before, but we wanted to make sure the students saw the breadth of opportunities out there. In the last 20 years, computer had really grown as a discipline but the curriculum had not grown to the same extent. So a primary motivation in revising the curriculum was to have it reflect the diversity of things you can do in computer science, and give students the flexibility to go more deeply in their areas of interest. But if you think of the set of all the areas you can touch on, the net you cast for students is much larger now. You’re not just bringing in students with a very particular, focused interest in building systems; you’re bringing in students interested in computational biology, or psychology and design, how people interact with computers. Same thing with graphics or movies or game-making. At this point we have about ten different tracks in our program. The number of computer science majors we have has tripled in five years since we did the curriculum revision.

And now a lot more students everywhere are choosing to major in computer science.

In terms of that trend turning around, part of it is the recovery in the high-tech economy, part of it is a change in perception. When people see companies like Google and Facebook being founded by relatively young people, they feel empowered and think: I can do that. And there’s the realization that the demand for computing, at least looking out over the next ten years, is certainly going to be there.

What are the factors that are still holding students back from studying computer science?

The problem is the educational opportunities. You take your average high school, and kids have several years of math classes, they have several years of science classes, several years of English, options for various kinds of vocational training, or history, or economics. But very few schools actually offer real computer science classes. So students don’t get the exposure in high school, of those who go to college, some have never considered computing before because they don’t really know what it is. One of the phenomena we see at Stanford is that the vast majority of our students, 90 percent of undergrads, take computer science classes even though there’s no requirement to do so. Some of them take it and end up loving it, but it’s too late to major in computer science. Had they been exposed to computer science earlier on, they could’ve started at a point that would allow them to pursue this as a major and as a career. When you take your first class your senior year and realize you love it, but you’re going to graduate in another quarter, you can’t complete a major. If there are more of those opportunities earlier in the pipeline, it will help address this.

You were working on your Ph.D. at Stanford and then left to work at Google. What was it like to be at Google in the early days?

Part of my reason for getting my Ph.D. was that I was always interested in being a professor. But I got my Ph.D. in 1998, right when the dot-com bubble craziness was going on. I worked for a start-up company called Ephiphany where some friends of mine were. But I knew the founders of Google from graduate school, and we were exchanging a few emails, and I went to look at the company. They were doing really interesting things, and the research I’d be doing there was related to work I’d done for my thesis, so I had a strong interest in it personally. And there was a part of me that wanted to see how this could be done at scale. How some of the algorithms that had been developed in lab could be applied to applications that were used by hundreds of billions of people.

That must have been an incredible feeling.

It was amazing seeing the level of growth and seeing how the technology really matters. Google is a very technology-driven company. It’s one thing to do some research, and there’s some satisfaction you get from coming up with a new method that works well, and writing a paper about it. But there’s a different level of satisfaction that ends up impacting a product that lots of people use on a daily basis.

And then how did you get back into teaching at Stanford?

After spending a number of years at Google, the opportunity came up to return to Stanford. I really loved it here, and I missed the interaction with students. Working with them to introduce them to new topics and see them have that “Aha!” moment where they learn something new and appreciate that learning process. I missed that.

Do you have a signature teaching style? Or a philosophy of teaching?

I try to do things that engage students by doing demos in class, and to have analogies to real-world events so it can take some of the ideas in computer science, which often tend to be abstract, and ground them in a physical analog that can help them remember it.  And it helps if it’s funny, too.

It must be interesting having students who’ve grown up in a digital world.

That also gives me an opportunity to motivate them. You can do an example in class that’s tied to their experience. It empowers them to think about not just being the user, but being the builder. For the last four years, in my intro class, Mark Zuckerberg comes every year to do a Q&A with the students. One of the assignments we do around that time is a simple version of Facebook that students write. And it helps give students the power of, you can do this, and the person who did this is going to come talk to you about what it was like for him.

I’ve read that women and minority students have been vastly underrepresented in high school computer science classes. In some states, no women or minority students even take the AP exam.

The disparity along gender and racial lines in computing is pretty stark. Part of that is that we need to have more of those opportunities. If we have education in computing at a small number of high schools and middle schools, they tend to be particular schools in certain demographic areas, and there are social dynamics involved, where early on, even in elementary school, the boys are taking the keyboards from the girls because they’re doing most of the typing. When you have a scarcity of an educational opportunity, there’s a greater potential for disparities. If everyone can get exposed, regardless of gender, socio-economic background, or race, you create more equality among the opportunities. We see that in a smaller way at Stanford. A couple of years ago we did a statistical study of women in computer science. Stanford, as a whole, is roughly 50/50. But the interesting thing is that when the enrollment numbers in computer science increased, not only did women join in greater numbers, but the percentage increased because we’re moving more towards the overall population percentage.

Should everyone take computer science?

There are two aspects to that. One has to do with technology being more a part of people’s lives, so everyone should have a better understanding of that technology. Even if they aren’t going to pursue a career in computing, they should have some notion of what a computer does, how it operates, and, when things aren’t working, what’s essentially wrong.

The other point is subtle. The ability to program or to understand different aspects of computing systems really involves clarity of thought. If you’re going to program a computer, you need to specify a set of instructions for the computer to execute, and those have to be sufficiently clear to get your problem solved. Otherwise, you have errors. Just having the clarity of thinking to lay out instructions is an analytical skill that’s useful for everyone.

Hope Reese is a writer and editor based in Louisville, Kentucky. She writes for The Boston Globe, The Chicago Tribune, and Vox. Her website is hopereese.com.