Ryan McCarty is a music major, but after his roommate raved about Princeton’s introductory computer science class, he decided to try it himself. McCarty has now used the Java programming skills that he learned in class to create a musical composition program for his junior year project.

“Now, my other roommate is taking it,” McCarty said. “He is a politics major.”

Computer science is not just for scientists anymore. In the past several years, the University’s basic computer course, “General Computer Science,” has seen its enrollment skyrocket from 131 in 2004 to the current level of 648. (Those numbers do not include students from Princeton’s Integrated Science course, who take “General Computer Science” for half a semester.) The course is now one of the most popular at Princeton. Much of that increase has come from students outside of the engineering school.

“When we started this, the idea was that there ought to be a course for any student at the University who wanted to learn some computer science,” said Robert Sedgewick, the William O. Baker *39 Professor in Computer Science. “This is a course for everyone.”

When Sedgewick started the course nearly 20 years ago, the vast majority of computer science courses either focused on specific fields, such as physics or engineering, or they dealt with individual programming languages such as C. It was Sedgewick’s belief that there were certain core principles of computer science and that beginning students could use a single programming language to obtain a strong foundation in these areas.

Kevin Wayne, the Phillip Y. Goldman ’86 Senior Lecturer in Computer Science and Sedgewick’s colleague and co-author of the class’s textbook, said the idea was to teach students to view computer programming as a tool to solve problems rather than as an isolated topic.

“We teach a good amount of programming but the goal is not to learn a computer language, but to learn to solve problems and understand computation,” Wayne said.

The instructors use Java as the class language because it is a common program and shares features with other languages. But Wayne said the choice of language was really secondary; the course focuses on creating a general structure of a program and on learning how to conceptualize a program to solve a complex task.

Jean Wang, a sophomore, said the course, which is a requirement in the engineering school, convinced several of her friends to major in computer science. Although she originally thought to major in operations research and financial engineering, Wang said she is now considering computer science as well.

“The problem sets in the course were very challenging but they were manageable,” she said. “They made you realize the different ways you could implement the skills that you have learned.”

Sedgewick said he is pleased that the course leads many students to a greater interest in computer science, but he feels strongly that computers are so integral to modern society that a basic understanding of the field should be a part of any education. In the introduction to their textbook, “Introduction to Programming in Java,” Sedgewick and Wayne say that in the modern world computer science cannot be left to specialists.

“The basis for education in the last millennium was reading, writing and arithmetic; now it is reading, writing and computing,” they write.

Sedgewick’s approach in “General Computer Science” has proven so popular at Princeton that professors at other universities, including Yale and the University of Pennsylvania, have created similar classes.

Benedict Brown, who earned his doctorate in computer science from Princeton in 2008, now teaches the introductory computer science course at Penn using the Princeton model. Brown, a former teaching assistant in “General Computer Science,” said when he first arrived at Penn, he suggested taking the same approach to basic computer science.

“They liked what they heard and thought it was a good model,” he said.

Brown said the course allows students to achieve a basic level of competence in programming and to reach a point at which “they know what they don’t know.”

“If they want to be computer scientists, they realize how much more there is to learn,” he said. “On the other hand, if they want to pursue it as a hobby or as an interest, they know enough to be successful.”