Usage patterns of objects of a class [message #872517] |
Wed, 16 May 2012 09:04 |
A E Messages: 3 Registered: May 2012 |
Junior Member |
|
|
There could be a feature in Eclipse to identify the distinct usage patterns of all the objects belonging to a specific class within a codebase.
In this thread we can discuss the details of how this is going to work and may be convert it to a Bugzilla feature request later.
Based on the conversation with Marcel Bruch (twitter.com/#!/AnoopElias/status/202657864903438338)
[Updated on: Wed, 16 May 2012 09:18] Report message to a moderator
|
|
|
Re: Usage patterns of objects of a class [message #872798 is a reply to message #872517] |
Wed, 16 May 2012 20:54 |
|
Would you like to see *all* patterns how a , say, java.io.File is used or just a collection of the most frequent/common patterns?
As tweeted, it seems that for java.io.File there may be more than 500 different method combinations: For example:
1:
f = new File(string);
boolean b = f.exists()
2:
f = new File(string);
File abs = f.getAbsolutePath()
...
500:
f = new File(string);
boolean b = f.exists()
File abs = f.getAbsolutePath()
I'm not sure this would be very helpful? What we are currently working on is an Eclipse plugin that shows the most frequent patterns how, say, a File object was used.
A preliminary screenshot (with a hard coded example) looks like this:
Is this what you want to see?
[Updated on: Wed, 16 May 2012 20:55] Report message to a moderator
|
|
|
|
Re: Usage patterns of objects of a class [message #873820 is a reply to message #873812] |
Sat, 19 May 2012 06:55 |
|
I think having a example usage catalogue would be great.
But just copying all fragments that use the type or method in question may help sometimes but IMO is less helpful as you get thousands of similar snippets for a method. Some aggregation and filtering is needed.
We've two students working on two different pattern mining approaches at the moment. One already starts finding the well known Java API patterns as for Iterator :
Collection c = ...
Iterator it = c.iterator()
while(it.hasNext()){
Object o = it.next();
}
He's currently fixing a few problems with his miner. But when he's ready, I'll generate a simple web page from these snippets for illustration. It would be great if we'd continue this discussion on how these snippets should be presented to developers and issues you have with the snippets in general.
Best,
Marcel
|
|
|
|
Powered by
FUDForum. Page generated in 0.06297 seconds