Posted by scottschram
on April 12, 2005 at 4:01 PM PDT
Koders.com searches over 180,000,000 lines of code from hundreds of open source projects.
I recently wanted to write a reusable FilenameFilter class. Before starting, I used the source code search engine at koders.com to research how other people had implemented solutions to a similar problem.
koders.com has indexed over 180,000,000 lines of code in hundreds of open source projects.
This is amazingly handy. Try searching for FilenameFilter . On the first page of results, it's easy to spot some trivial implementations (using endsWith("xml"), for example).
Further down are classes that combine other FilenameFilters with boolean operators: AndFileFilter, OrFileFilter, etc.
There is code from the Jakarta Commons that helps with contruction of filters that act as Swing FileFilter and java.io.FilenameFilter, as well as an example of making a singleton using a static public INSTANCE variable and protected constructors. Very nice.
Clicking on the returned file name lists the colorized code. Clicking on the project name shows the approximate size of the project, an estimated cost to re-implement it from scratch, and the language composition.
Searches may be limited to a given language or license. This could be improved to offer a search for commercial-friendly vs. GPL style licenses.
Koders.com offers an Enterprise Edition for indexing your own company's internal codebase.
As a result of my search, I have decided to include Jakarta Commons IO in my project, and write in that style, leveraging the work that is already there.
Koders.com could also be used when confronting an apparently awkward API to see if anyone has an elegant solution or as a rough guide to the popularity of an API.