Seven-term Rep. Mike Honda has long celebrated his resume as a former science teacher, school principal and school board member in the South Bay. But facing the fight of his political life in a Silicon Valley district where tech startups and venture capitalists are royalty, Honda found himself Tuesday on entirely new terrain - hosting a "mobile app computer coding" class for high school students.

"I used to teach at a high school in this district in 1969. ... That was before your mother was born," the 72-year-old Honda told two dozen students at Fremont High School in Sunnyvale who took part in a free, Microsoft-sponsored training session.

The ability to "crank" computer code "is going to be required in a lot of areas," he said. "By 2020, there's going to be a million jobs in computer science."

The visit was billed as an official congressional event - but the venue was no coincidence.

Opponent's issue

Teaching computer coding in the schools from an early age has been a signature issue for Honda's main challenger in the June 3 primary, former Obama administration trade representative Ro Khanna. The 38-year-old Democrat has the backing of Silicon Valley executives including Sheryl Sandberg of Facebook and Marissa Mayer of Yahoo.

Honda's effort to score points on the tech topic underscores the need for his campaign - and that of any other candidate in the Bay Area - to talk about the issues that matter to the monied and influential Silicon Valley political crowd.

Microsoft's senior director of mobile app strategy, Reggie Hutcherson, helped Honda with Tuesday's event and said other Bay Area House members, including Minority Leader Nancy Pelosi of San Francisco and East Bay Democratic Rep. George Miller, have expressed interest in bringing computer-coding boot camps to their districts.

App contest

Aides also pointed out that Honda's young constituents are eligible to enter the House Student App Challenge, in which high school students compete to create the most innovative software application for mobile devices, tablets or other tech gadgets on a platform of their choice. The contest is co-sponsored by Rep. Anna Eshoo, D-Palo Alto, whose district also covers a wide swath of Silicon Valley.

Honda told the students he had learned some new tricks in such boot-camp sessions, including "how to make Angry Birds move from one side of the screen to the other."

"Most of you guys can probably do that in your sleep," he conceded.

Mixing messages

Even as he shows his affinity for tech, however, Honda's campaign has sometimes taken a more skeptical approach to the tech takeover of the South Bay.

Last week, the campaign circulated a mailer attacking Khanna for cozying up to the "millionaires" of the district. And in a recent fundraising letter, the Honda camp happily cited The Chronicle's endorsement of Khanna, which said the incumbent's lack of engagement with tech executives in his community was "simply unacceptable."

"This actually touches on a key distinction between Mike and the opponent The Chronicle endorsed, and it's one that we're proud of," the fundraising letter said. "Mike is focused on making sure our economy works for everyone, not just the wealthiest, and he has the record to back it up."

Coding-class push

Honda's boot-camp appearance Tuesday was at least a tacit endorsement of tech executives' campaign to spread coding classes through the schools.

But at least one candidate in the South Bay congressional race questions the effort to get government involved.

Silicon Valley executive recruiter Joel VanLandingham, a Republican, said Tuesday that nonprofits like Code.org and companies such as Microsoft and Hewlett-Packard are already helping to spread coding education in schools.

If government gets into the game, he said, the result will be an inefficient "post-office approach."