Scripted Searches for Java Code in Popular Source Code Search Engines
Sometimes the best way to solve a programming problem is to see how others have done the same thing. When that happens, having immediate access to the various search engines helps get you back on track quickly. Here are OpenSearch plug-ins (suitable for Firefox and MSIE7) that will search the Java code in five of the more popular source code search engines.
Krugle
Krugle is not only a source code search engine, but an entire environment for developers to review an comment on code. It supports code search by crawling, parsing and indexing code found in all open source repositories, as well as code that exists in archives, mailing lists, blogs, and web pages. Krugle also provides answers to code-related technical questions: related code, dependencies, licensing information, compatibility requirements, bug reports and news group postings. Finally, it lets one add comments to entire code files or specific lines of code, allowing for useful code-centric communication between developers.
Install Krugle Java Code Search for Firefox and MSIE7. Plug-in source:
1 2 3 4 5 6 7 8 9 10 11 12 |
|
Koders
Koders is a repository of open source project code. From their own description of themselves:
Koders.com is the leading search engine for open source code. Our source code optimized search engine provides developers with an easy-to-use interface to search for source code examples and discover new open source projects which can be leveraged in their applications.
Note also that you can get a plugin for Eclipse to perform the searches right from the IDE. Install Koders Java Search in Firefox or MSIE7. Plug-in source:
1 2 3 4 5 6 7 8 9 10 11 12 |
|
Codefetch
Codefetch is a search engine for source code from published books. Oftentimes, publishers and/or authors will make the example source code available online. Codefetch indexes those bits of sample source code and provides links to bookstores where you can buy the book associated with the code. Be sure to check out their help and examples screen for the more sophisticated search and limiting parameters.
Install Codefetch Java Search in Firefox or MSIE7. Plug-in source:
1 2 3 4 5 6 7 8 9 10 11 12 |
|
O'Reilly Publishing
Another source of edited example code is from O'Reilly Publishing. This, too, is "in the labs" so it may go away at some point. In the meantime, one can "find relevant sample code from nearly 700 O'Reilly books. The database currently contains over 123,000 individual examples, composed of 2.6 million lines of code — all edited and ready to use." Do make note of the O'Reilly Policy on Re-Use of Code Examples from Books.
Install O'Reilly Java Code Search in Firefox and MSIE7. Plug-in source:
1 2 3 4 5 6 7 8 9 10 11 12 |
|
Google Code Search
In the nebulous Google Labs (will it disappear? will it stay in the labs? will it become a "normal" service?) there is a Code Search service. This is how Google describes it:
Google Code Search helps you find function definitions and sample code by giving you one place to search publicly accessible source code hosted on the Internet. With Google Code Search, you can:
- Use regular expressions to search more precisely
- Restrict your search by language, license or filename
- View the source file with links back to the entire package and the webpage where it came from
The use of regular expressions seems to give Google an edge over the others, although I don't think the Google service is as comprehensive in coverage as Koders.
Install Google Code Search for Java into Firefox or MSIE7. Plug-in source:
1 2 3 4 5 6 7 8 9 10 11 12 |
|
The text was modified to remove a link to http://www.codefetch.com/examples.html on November 6th, 2012.