Google Inc. is introducing a new search service that only a geek could love.
Search giant gives software developers a tool that lets them search billions of lines of source code.
The Web search leader of late said that it is introducing Google Code Search, a site that simplifies how software developers search for programming code to improve existing software or create new programs.
Google product manager Tom Stocky said the Mountain View, California-based company is set to help programmers sift through billions of lines of computer source code using its familiar search box to uncover snippets of reusable software.
“For a long time it has been sort of an unsolved problem,” said Stocky, a product manager in the developer products group. “It is hard to find references to this sort of data.”
The service – Google Code Search – conceived by the Google Labs early technology group, will crawl publicly available code, most of which is made available through open source projects. The search and indexing can cover code on web pages as well as code that reside in compressed files, according to Stocky.
Google expects that the search engine will be used primarily as a learning tool to help students and serious programmers, rather than a way to find and copy another person’s code.
"Most of the code is open source so you can reuse it. But I do not think that is the primary use — it is more about how to learn about things and, when you are building open-source packages, to make sure you doing it the right way," Stocky said.
For example, a developer may need to write a function as part of an application and search the Web to see other examples.
No Secret Code
Google is applying the same machine-driven techniques it uses to help consumers search the Web for text, images, video and books to help professional programmers as well as computer enthusiasts overcome stumbling blocks to writing code.
It is commonplace, when looking to improve a particular line of software, for most code writers to search the Web for quick tips. But finding actual programming code rather than just discussions about a particular coding problem is tough.
Google engineers, many of whom participate in open source projects, already use these code searching capabilities internally. Since it is a Google Labs project, the company is not yet seeking to monetize searches through ads, Stocky said.
To meet this need, sites such as Koder, O’Reilly Labs or ProgrammingIsHard.com have sprung up that offer repositories of code. Most are small, require membership and are often devoted to only a specific class of software or problem.
Some programmers say Google Code Search answers some of the nightmares of building software, by creating a central place to trawl for publicly available code.
"Google Code Search may come in handy when looking for different ways of approaching a particular programming problem," said Niall Kennedy, a San Francisco technical blog commentator.
The search engine will let people to do both keyword search and "regular expressions," which allow people to search a specified pattern, he said. For example, a person could narrow search to JavaScript functions, which will help find more examples, Stocky said.
Searchers can seek out specific programming terms or computer languages and dive deep into compressed code to locate specific features. Users also can narrow a search to find software code based on specific licensing requirements, which is a big deal in warding off future patent litigation.
Similar to how a consumer might type a few words into a standard Google search box for answers, programmers can seek out relevant lines of code at http://google.com/codesearch — except the results are for machine-readable phrases such as: "go{2}gle" "hello,\ world" or "^int printk."
As it does with many of its services, Google will release an application programming interface (API) to create an XML feed based on a specific query.
Others were less impressed: “Functional and simple, but therein lies the problem,” said the writer of a site called “Digital Alchemy,” who sees few advantages over existing sites.
Although it does not sell programming tools, Google has an active developer outreach program and relies on third-party programmers to enhance its services. Google searches through code repositories that are popular among programmers — CollabNet’s Subversion and another alternative called CVS, Stocky said.
For example, developers have created popular mash-up applications that display information from one website using its Google Maps service.
Stocky said: "More and more [the developer community] is the way Google products are getting to scale. We think developers can really improve Google products and use Google technology to improve their own products."
The service began as a way for Google programmers to search through internal company code. It added a search of publicly available code and recently Google decided it might as well open up the service to others.
Initially, Google Code Search is free of advertising. Should the site prove popular, Stocky said Google may consider running pay-per-click advertising along search results, the way it makes money from its more mainstream search services, he said.