Stone Bridge High School seniors, all 18, from left, Jon Ting, Eric Velosky and Jacob Hibbard, take partin a computer science ”camp” this month in Reston, Va. (Katherine Frey/The Washington Post)

Their lives swirl in technology, but the nation’s high school students spend little time studying the computer science that is the basis of it all. Few are taught to write lines of code, and few take classes that delve into the workings of the Internet or explain how to create an app.

In a world that went digital long ago, computer science is not a staple of U.S. education, and some schools do not even offer a course on the subject, including 10 of 27 high schools in Virginia’s Fairfax County and six of 25 in Maryland’s Montgomery County.

“It’s shocking how little there is,” said Rebecca Dovi, who has taught computer science for 17 years in Virginia schools and is an advocate for more courses statewide. Even when schools offer classes, she said, there are relatively few of them. “You might have one person teaching it in a school of 1,400 kids.”

Though computer science can lead to high-paying technology jobs and boost skills for a variety of fields, many students get little exposure to the subject in class. Across the Washington region’s school systems, fewer than one in 10 high school students took computer science this academic year, according to district data.

But, slowly, that might be starting to change. Spurred in part by national initiatives, some local districts are urging more students to take computer science courses and trying to address a glaring gender and racial disparity. By next school year, school leaders expect more computer science courses in Montgomery high schools, more enrollment in courses in Virginia’s Loudoun County and more schools offering classes in the District.

And Charles County, Md., with 26,500 students, has committed to bring such learning into every grade starting in the fall, in partnership with the nonprofit Code.org, which works to increase access to computer science in schools.

“We really believe the skills they will get from coding will help them in whatever career they choose,” said Charles County Superintendent Kimberly Hill, who pointed out that such learning requires logic and “habits of the mind” that have broader uses.

Computer science is not just for math whizzes and budding techies, she said.

“Typically it’s male. Typically it’s white male,” Hill said, adding that it begs the questions: “Where are all the girls? Where are all the African American and Hispanic kids?”

Under the county’s new plan, she said, the thinking is, “You can learn how to code, like you can learn how to read and learn how to write.”

Among the reasons many schools do not have computer science: It is not a priority core subject, and computer science teachers can be hard to find, with some drawn to higher-paying tech jobs. While an increasing number of states allow the courses to count as a math or science credit, they are usually not a requirement and are sometimes viewed by students as boring or intimidating.

Many parents mistake the computers they see in schools — and the seeming ease with which teenagers manage their devices — as a signs of computer science understanding.

Computer science in the region's schools (The Washington Post/Source: The school districts)

“These skills are as fundamental as algebra,” said Marie desJardins, a computer science professor at the University of Maryland Baltimore County who is leading a project to train 100 computer science teachers in Maryland and the District over a three-year period.

During the next decade, about 70 percent of new jobs in science, technology, engineering and math fields will be for computing professionals, desJardins said.

“There is not a field right now that computer science doesn’t contribute to or support,” said Chris Stephenson, executive director of the Computer Science Teachers Association. Still, she said, “most kids don’t have a chance to get introduced to this content in high school, and the kids that are least likely to have these opportunities are in high-poverty, high-minority schools.”

Hoping to reach more students, especially girls and minorities, Montgomery’s school leaders also have signed on with Code.org. Ten county high schools are slated to offer more-engaging courses that go beyond programming, with inquiry-based learning and topics such as the Internet and human-computer interaction.

“As a school system and a nation, we’re stuck in a box where computer science is not what we teach kids; it’s just something that you learn maybe later,” said Pat Yongpradit, a former Montgomery teacher who is director of education at Code.org.

Code.org has brought widespread attention to the learning gap, first with a video early last year that went viral — “What Most Schools Don’t Teach” — and then in December with a week-long “Hour of Code” campaign that drew in millions of people worldwide. The organization has partnered with an increasing number of school systems nationally — 32 as of this month — providing professional development for teachers and new curricular materials.

In Rockville, David Silversmith needed no convincing. One recent morning at Thomas S. Wootton High School, the 17-year-old senior was puzzling over a line of code for a computer-based game of Connect Four. Silversmith has no plans to become a computer scientist but decided the class was important.

“I think whatever profession you do nowadays,” the Maryland teen said, “it will definitely help.”

In D.C. public schools, new courses were offered this school year at six high schools and another four high schools will get computer science classes in the fall.

“The kids like these classes, they’re showing up for them, they’re engaged,” said Anthony Priest, a D.C. schools program manager. The District’s H.D. Woodson High School made computer science a requirement for all ninth-graders.

There are smaller efforts to expand computer science, too. In Fairfax County, teacher Dan Tra jazzed up a programming course with lots of app development, worked hard to market it, and got about 130 students to take the class at Falls Church High School this year. More than 40 percent of the students were female.

Falls Church now has a Robotics Club and a Girls in Technology Club. More than 20 students entered a hack-athon in late March, some winning honors.

“In our school, there’s a thirst for it,” Tra said.

Computer science courses are poorly tracked nationally and often misunderstood, experts say. Many people confuse courses about using computer software with true computer science, which is about creating and ­problem-solving with computers.

The most reliable figures about computer science’s reach into high schools come from the Advanced Placement (AP) exam. In Fairfax County, which has nearly 52,000 high school students, 740 students took the most recent AP exam in computer science. In Montgomery, with more than 45,000 high school students, 521 took the most recent AP exam. There were a little more than 600 exam-takers combined for public school systems in the District, Prince George’s County in Maryland, and Alexandria and Arlington, Loudoun and Prince William counties in Virginia.

Barbara Ericson, a senior research scientist at Georgia Tech who studies AP computer science results, said Maryland, Virginia and the District made the top-10 list for computer science participation per capita in 2013. Nationally, 29,555 students took the exam.

Still, Ericson said, it remains a course of the few: More than 270,000 students took the most popular AP calculus exam last year, and nearly 200,000 took biology exams. In 2013, girls accounted for 18.6 percent of computer science exam-takers, Hispanic students 8.1 percent and black students 3.7 percent.

Locally, there are signs of both the problem and new interest.

T.C. Williams High School in Alexandria, for example, lost its computer science teacher and was unable to find another who was certified, so the seven students now in the course take it online, officials said.

In Loudoun, enrollment is on the rise and a Microsoft program called Technology Education and Literacy in Schools, or TEALS, has brought professionals into classrooms. All 13 Loudoun high schools offer computer science and AP computer science.

Dan Kasun, a Microsoft executive involved in the program, said the collaboration inspires teachers, who in turn get their students excited. About 1,075 students are expected to take classes next year in Loudoun, up from 845 this year.

“People are realizing these are the skill sets that are going to lead to 21st-century jobs,” Kasun said.

Get updates on your area delivered via e-mail