Schools that have begun to incorporate computer science say the biggest challenges have been finding people qualified to teach it, and adding yet another requirement to the mountain of skills that students already need to graduate. The National Science Foundation has said it plans to train 10,000 teachers to teach computer science.

“The difficulty is getting enough teachers who are trained in it, and trained well enough to make it a good introduction to computer science,” said Barbara Ericson, the director of computing outreach at Georgia Tech’s College of Computing. “And if you are well-trained in computer science, you can make a lot more money in industry than teaching.”

Nationally, computer science jobs are some of the fastest growing and highest paying, but a majority of students have no access to computer science classes before college. A quarter of principals say their schools offer computer programming courses, according to data from Google and Gallup. Just 6 percent of high schools are certified to offer Advanced Placement computer science courses.

But interest in computer science is growing among both schools and students. Last year, the number of students taking the A.P. test increased 25 percent over the year before, to 48,994.

In New York City, some of the most elite public schools, like Stuyvesant High School, have offered computer science courses for years. Mr. Wilson said in an interview that he had long wanted to see computer science education expanded to a wide range of schools. But he said it was only in the past several years that the city had evidence, from the Academy for Software Engineering and other programs, that students who were behind grade level in math and reading, as most students in the system are, could benefit from computer science classes.

The Laboratory School of Finance and Technology, a middle and high school in the Bronx, requires all its students to take computer science courses in each year of middle school.

One of the school’s computer science teachers, Ben Samuels-Kalow, is certified to teach in social studies, but when he was doing his teaching residency at the school in the 2012-13 school year, the principal, Ramon Gonzalez, noticed that he was computer savvy and asked if he would participate in a pilot program aimed at training teachers in teaching computer science.