Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Usage patterns of objects of a class(Identify distinct usage patterns of the objects of a class in a codebase)
Usage patterns of objects of a class [message #872517] Wed, 16 May 2012 09:04 Go to next message
A E is currently offline A EFriend
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 Go to previous messageGo to next message
Marcel Bruch is currently offline Marcel BruchFriend
Messages: 289
Registered: July 2009
Senior Member

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:
index.php/fa/9756/0/

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 #873812 is a reply to message #872798] Sat, 19 May 2012 06:29 Go to previous messageGo to next message
A E is currently offline A EFriend
Messages: 3
Registered: May 2012
Junior Member
I can think of a couple of use cases for this,

1. Typically, if I am new to a project, and have to use an unheard API, I would copy and paste the usages from elsewhere on the same project. As, I don't know the ground rules, if I break some, I would rather break those which somebody already broke.

2. If I am the author of a framework, this feature might help me to identify the most used patterns of my API. This might help me lay down the roadmap for the framework.

These are some 'nice to have' use cases. Can you think of anything else?
Re: Usage patterns of objects of a class [message #873820 is a reply to message #873812] Sat, 19 May 2012 06:55 Go to previous messageGo to next message
Marcel Bruch is currently offline Marcel BruchFriend
Messages: 289
Registered: July 2009
Senior Member

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
Re: Usage patterns of objects of a class [message #875192 is a reply to message #873820] Tue, 22 May 2012 09:43 Go to previous message
A E is currently offline A EFriend
Messages: 3
Registered: May 2012
Junior Member

Agreed, It would help showing and aggregated usage patterns list than the entire list. This can then be linked to a number of occurances or to the occurances itself.

This is not trivial and would involve quiet a bit of thought process and trial & error. It would be great if you can put a sample illustration.
Previous Topic:Installing Indigo on a notebook
Next Topic:How to export / share projects without SCM?
Goto Forum:
  


Current Time: Sat Apr 27 02:39:51 GMT 2024

Powered by FUDForum. Page generated in 0.08766 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top