tags:

views:

647

answers:

4

Given a large API (an in particular, the Java or J2EE standard libraries), is there a tool or search engine or other resource that can tells me which methods, classes, or even packages people in general tend to use the most? I am annotating (see below) APIs and would like to focus my attention on popular areas. The only thing I can think of is using google code with different method names but that is of course tedious.

Some background (if anyone is interested): As part of my PhD research I've developed a tool that allows users to highlight important "directives" in method documentation (their own or in existing APIs) and then pushes these annotations to users to increase chances that they become aware of it. Our lab studies show that this has potential, but to get people to use it in the field I have to provide "corpuses" of annotated APIs and I'm trying to prioritize which libraries to annotate.

+4  A: 

I wouldn't know if such statistics are even feasible, but I think a pretty safe bet would be to start with the basics plus some famous third party libraries. For example:

As for third parties

Vinko Vrsalovic
This is a pretty good starting point. I'd add JDBC to the list.
Bill the Lizard
Yes. Not many people use Networking API directly, though. Swing is probably the least used.Properties is another very common API that I've seen along with REsource Bundles.
anjanb
I would almost believe that some String functions occur more than collections.
Axeman
@Axeman: I'm sure you're right, but String is in the core java.lang package.
Bill the Lizard
+1  A: 

This "simple" bash script will count most used classes in your current project codebase.

find . -name "*.java" | xargs cat | grep "^import java" |  sort | uniq -c | sort -nr | head -100
Dev er dev
Which rather obviously, ignores the java.lang package. It akso fails to consider the frequency of usage. A nice try (no pun)
questzen
A: 

It seems like it would be possible to automate a process where a list of J2SE or J2EE packages could be submitted to Koders.com, Google Code or another open source code search repository, count the results per package and sort for the most popular.

Note that this won't give you absolutely complete results, as java.lang (or any other package/class that is implicitly imported) won't show up in that search.

I don't think there is an existing tool or publisher of this information, although I could be mistaken.

Another possibility is to pick a number of 'representative' projects, download them and use a dependency analysis tool, like JDepend, to generate dependency reports and process them to get a set of packages/classes in use.

Ken Gentle
A: 

I presume, you want to rank them on basis of frequency of usage. I would suggest you download some open source java projects, run a static analysis tool. Then on the same set run a memory profiler and finally extrapolate these statistics

questzen