Scripted Searches for Java Code in Popular Source Code Search Engines
3 minute read
This article was imported from this blog's previous content management system (WordPress), and may have errors in formatting and functionality. If you find these errors are a significant barrier to understanding the article, please let me know.
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 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.
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.
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.
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.