X

Geertjan's Blog

  • May 1, 2015

Eclipse Recommenders for NetBeans IDE (Part 1)

Geertjan Wielenga
Product Manager

Wouldn't it be handy to know how other developers have used the Java API
that you're learning about? Imagine that you're learning about java.util.List, you invoke code completion in your Java editor, and you see that 31.84% of users of the List class have used iterator() and, most usefully of all, that the most widely used methods on the List class were to be found right at the top of the code completion box, as shown below, in NetBeans IDE? Even if you're not learning about an API, instead you're using it in your daily development work, it's handy to have the most widely used methods of an API listed at the top of the code completion box.

Welcome to the world of Eclipse Code Recommenders.

Marcel Bruch, who leads this project, has a bunch of slides explaining it all here:

http://www.slideshare.net/Microbiotic/eclipse-code-recommenders-majug-2011

The obvious question is how those percentages are calculated. Marcel tells me: "We use example applications from the Eclipse Marketplace, Maven Central, and other public Maven repositories to build recommendation models. There is also a crowdsourcing approach in place where developers share their knowledge how they use these APIs. For companies, we use in-house code repositories like Nexus or VCS like SVN, Git etc."

Right now only JDK classes are available by default, i.e., if you call up code completion on some class that is not in the JDK, you will not get recommendations. I asked Marcel about that, i.e., "How can new libraries be added, right now only JDK libraries are included", and his response: "We're currently setting up co-operation with other companies to support models for other public frameworks. Primary focus will be on Java EE standard classes and Apache libraries."

A related question I had is how come the percentages add up to over 100%. His response: "The percentage says how likely it is that you will call a given method in your code. If you must call two methods, both methods will have 100%. Same with overrides—if you subclass a type and have to override two methods in there, both will have 100%."

If you'd like to try out these concepts in NetBeans IDE, there's an Update Center by Jan Lahoda that you can register in Tools | Plugins to install the plugins that provides this feature:

http://lahoda.info/hudson/job/nb-code-recommenders/lastSuccessfulBuild/artifact/build/updates/updates.xml

On GitHub:

https://github.com/jlahoda/nb-code-recommenders

Join the discussion

Comments ( 5 )
  • guest Friday, May 1, 2015

    that is really cool


  • Mike Saturday, May 2, 2015

    It is really good.


  • guest Sunday, May 17, 2015

    Hi,I'm a student from Xi'an,China,a Java fans,who is new to Netbeans.I did what you say, but I could not see the plugin in my Tools | Plugins.Could you please tell me how I should do to make it?Thanks a lot~


  • guest Sunday, May 17, 2015

    Hi,I'm a student from Xi'an,China,a Java fans,who is new to Netbeans.I did what you say, but I could not see the plugin in my Tools | Plugins.Could you please tell me how I should do to make it? My email is 1069200225@qq.com.Thanks a lot~


  • Geertjan Sunday, May 17, 2015

    If you'd like to try out these concepts in NetBeans IDE, there's an Update Center by Jan Lahoda that you can register in Tools | Plugins to install the plugins that provides this feature:

    http://lahoda.info/hudson/job/nb-code-recommenders/lastSuccessfulBuild/artifact/build/updates/updates.xml


Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.