RACK: Automatic API Recommendation using Crowdsourced Knowledge

Abstract: Traditional code search engines often do not perform well with natural language queries since they mostly apply keyword matching. These engines thus need carefully designed queries containing information about programming APIs for code search. Unfortunately, existing studies suggest that preparing an effective code search query is both challenging and time consuming for the developers. In this paper, we propose a novel API recommendation technique–RACK that recommends a list of relevant APIs for a natural language query for code search by exploiting keyword-API associations from the crowdsourced knowledge of Stack Overflow. We first motivate our technique using an exploratory study with 11 core Java packages and 344K Java posts from Stack Overflow. Experiments using 150 code search queries randomly chosen from three Java tutorial sites show that our technique recommends correct API classes within the top 10 results for about 79% of the queries which is highly promising. Comparison with two variants of the state-of-the-art technique also shows that RACK outperforms both of them not only in Top-K accuracy but also in mean average precision and mean recall by a large margin. Once the NL query is reformulated into relevant API classes, we use them for code search using GitHub code search API. Our tool then returns a list of relevant code examples for the given NL query.


Experimental Data

Since we are working on journal version, the dataset is not yet made public. Please contact Masud Rahman for information related to the experiment.

RACK Plug-in

Plug-in overview
  • Type: Eclipse IDE Plug-in
  • System Requirement: Kepler 4.3.2+ (Tested)
  • Prototype: RACK update site
RACK Installation
  1. Copy the update site URL
  2. Use with Help>Add New Software>Work with option of Eclipse IDE for RACK installation
  3. Installation will require the IDE to restart
  4. Once installed successfully, you will see RACK icon in the main menu
  5. Please check Use remote option for code search if you do not have RACK server installed
RACK User Guide

Related Publication(s)

author={Rahman, M. M. and Roy, C. K. and Lo, D.},
booktitle={Proc. SANER}, title={{RACK}: {A}utomatic {API} {R}ecommendation using {C}rowdsourced {K}nowledge},
pages={349--359} }

author={Rahman, M. M. and Roy, C. K. and Lo, D.},
booktitle={Proc. ICSE}, title={RACK: Code Search in the IDE using Crowdsourced Knowledge},
pages={51--54} }

© Masud Rahman, Computer Science, University of Saskatchewan, Canada.