FOCUS: A Recommender System for Mining API Function Calls and Usage Patterns

Software developers interact with APIs on a daily basis and, therefore, often face the need to learn how to use new APIs suitable for their purposes. Previous work has shown that recommending usage patterns to developers facilitates the learning process. Current approaches to usage pattern recommendation, however, still suffer from high redundancy and poor run-time performance. In this paper, we reformulate the problem of usage pattern recommendation in terms of a collaborative-filtering recommender system. We present a new tool, FOCUS, which mines open-source project repositories to recommend API method invocations and usage patterns by analyzing how APIs are used in projects similar to the current project. We evaluate FOCUS on a large number of Java projects extracted from GitHub and Maven Central and find that it outperforms the state-of-the-art approach PAM with regards to success rate, accuracy, and execution time. Results indicate the suitability of context-aware collaborative-filtering recommender systems to provide API usage patterns.

[1]  Annie Chen,et al.  Context-Aware Collaborative Filtering System: Predicting the User's Preference in the Ubiquitous Computing Environment , 2005, LoCA.

[2]  Martin P. Robillard,et al.  How API Documentation Fails , 2015, IEEE Software.

[3]  Gabriele Bavota,et al.  Supporting Software Developers with a Holistic Recommender System , 2017, 2017 IEEE/ACM 39th International Conference on Software Engineering (ICSE).

[4]  P. Jaccard THE DISTRIBUTION OF THE FLORA IN THE ALPINE ZONE.1 , 1912 .

[5]  Mukund Raghothaman,et al.  SWIM: Synthesizing What I Mean - Code Search and Idiomatic Snippet Synthesis , 2015, 2016 IEEE/ACM 38th International Conference on Software Engineering (ICSE).

[6]  Houari A. Sahraoui,et al.  Could We Infer Unordered API Usage Patterns Only Using the Library Source Code? , 2015, 2015 IEEE 23rd International Conference on Program Comprehension.

[7]  Paul Klint,et al.  M3: A general model for code analytics in rascal , 2015, 2015 IEEE 1st International Workshop on Software Analytics (SWAN).

[8]  Juri Di Rocco,et al.  CrossSim: Exploiting Mutual Relationships to Detect Similar OSS Projects , 2018, 2018 44th Euromicro Conference on Software Engineering and Advanced Applications (SEAA).

[9]  Charles A. Sutton,et al.  Parameter-free probabilistic API mining across GitHub , 2015, SIGSOFT FSE.

[10]  Christoph Treude,et al.  Augmenting API Documentation with Insights from Stack Overflow , 2016, 2016 IEEE/ACM 38th International Conference on Software Engineering (ICSE).

[11]  Martin P. Robillard,et al.  Discovering essential code elements in informal documentation , 2013, 2013 35th International Conference on Software Engineering (ICSE).

[12]  Gabriele Bavota,et al.  Mining StackOverflow to turn the IDE into a self-confident programming prompter , 2014, MSR 2014.

[13]  Chanchal Kumar Roy,et al.  Towards a context-aware IDE-based meta search engine for recommendation about programming errors and exceptions , 2014, 2014 Software Evolution Week - IEEE Conference on Software Maintenance, Reengineering, and Reverse Engineering (CSMR-WCRE).

[14]  Houari A. Sahraoui,et al.  Mining Multi-level API Usage Patterns , 2015, 2015 IEEE 22nd International Conference on Software Analysis, Evolution, and Reengineering (SANER).

[15]  Tao Xie,et al.  SpotWeb: Detecting Framework Hotspots and Coldspots via Mining Open Source Code on the Web , 2008, 2008 23rd IEEE/ACM International Conference on Automated Software Engineering.

[16]  Mehrbakhsh Nilashi,et al.  Collaborative filtering recommender systems , 2013 .

[17]  A F R S Sir Ronald Fisher,et al.  CONFIDENCE LIMITS FOR A CROSS‐PRODUCT RATIO , 1962 .

[18]  R. Holmes,et al.  Using structural context to recommend source code examples , 2005, Proceedings. 27th International Conference on Software Engineering, 2005. ICSE 2005..

[19]  Michele Lanza,et al.  Leveraging Crowd Knowledge for Software Comprehension and Development , 2013, 2013 17th European Conference on Software Maintenance and Reengineering.

[20]  Mira Mezini,et al.  Ieee Transactions on Software Engineering 1 Automated Api Property Inference Techniques , 2022 .

[21]  Frank Maurer,et al.  What makes a good code example?: A study of programming Q&A in StackOverflow , 2012, 2012 28th IEEE International Conference on Software Maintenance (ICSM).

[22]  Ying Zou,et al.  API usage pattern recommendation for software development , 2017, J. Syst. Softw..

[23]  Westley Weimer,et al.  Synthesizing API usage examples , 2012, 2012 34th International Conference on Software Engineering (ICSE).

[24]  Xiaodong Gu,et al.  Deep Code Search , 2018, 2018 IEEE/ACM 40th International Conference on Software Engineering (ICSE).

[25]  Xiaodong Gu,et al.  Deep API learning , 2016, SIGSOFT FSE.

[26]  Anh Tuan Nguyen,et al.  Statistical learning approach for mining API usage mappings for code migration , 2014, ASE.

[27]  Jian Pei,et al.  MAPO: Mining and Recommending API Usage Patterns , 2009, ECOOP.

[28]  Gabriele Bavota,et al.  How Can I Use This Method? , 2015, 2015 IEEE/ACM 37th IEEE International Conference on Software Engineering.

[29]  John Riedl,et al.  Item-based collaborative filtering recommendation algorithms , 2001, WWW '01.

[30]  Paulo Gomes,et al.  Context-based recommendation to support problem solving in software development , 2012, 2012 Third International Workshop on Recommendation Systems for Software Engineering (RSSE).

[31]  David Lorge Parnas,et al.  Information Distribution Aspects of Design Methodology , 1971, IFIP Congress.

[32]  Tzu-Tsung Wong,et al.  Performance evaluation of classification algorithms by k-fold and leave-one-out cross validation , 2015, Pattern Recognit..

[33]  Martin P. Robillard,et al.  What Makes APIs Hard to Learn? Answers from Developers , 2009, IEEE Software.

[34]  Roberto Di Cosmo,et al.  Software Heritage: Why and How to Preserve Software Source Code , 2017, iPRES.

[35]  Xavier Blanc,et al.  Automatic discovery of function mappings between similar libraries , 2013, 2013 20th Working Conference on Reverse Engineering (WCRE).

[36]  Kai Chen,et al.  Mining succinct and high-coverage API usage patterns from source code , 2013, 2013 10th Working Conference on Mining Software Repositories (MSR).

[37]  Hidehiko Masuhara,et al.  A spontaneous code recommendation tool based on associative search , 2011, SUITE '11.

[38]  Jian Pei,et al.  Mining API patterns as partial orders from source code: from usage scenarios to specifications , 2007, ESEC-FSE '07.

[39]  Juri Di Rocco,et al.  Knowledge-aware Recommender System for Software Development , 2018, KaRS@RecSys.

[40]  Eran Yahav,et al.  Code completion with statistical language models , 2014, PLDI.

[41]  Ron Kohavi,et al.  A Study of Cross-Validation and Bootstrap for Accuracy Estimation and Model Selection , 1995, IJCAI.

[42]  Markus Zanker,et al.  Linked open data to support content-based recommender systems , 2012, I-SEMANTICS '12.