Recommending API Function Calls and Code Snippets to Support Software Development

Software development activity has reached a high degree of complexity, guided by the heterogeneity of the components, data sources, and tasks. The proliferation of open-source software (OSS) repositories has stressed the need to reuse available software artifacts efficiently. To this aim, it is necessary to explore approaches to mine data from software repositories and leverage it to produce helpful recommendations. We designed and implemented FOCUS as a novel approach to provide developers with API calls and source code while they are programming. The system works on the basis of a context-aware collaborative filtering technique to extract API usages from OSS projects. In this work, we show the suitability of FOCUS for Android programming by evaluating it on a dataset of 2,600 mobile apps. The empirical evaluation results show that our approach outperforms two state-of-the-art API recommenders, UP-Miner and PAM, in terms of prediction accuracy. We also point out that there is no significant relationship between the categories for apps defined in Google Play and their API usages. Finally, we show that participants of a user study positively perceive the API and source code recommended by FOCUS as relevant to the current development context.

[1]  F. Wilcoxon Individual Comparisons by Ranking Methods , 1945 .

[2]  Vladimir I. Levenshtein,et al.  Binary codes capable of correcting deletions, insertions, and reversals , 1965 .

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

[4]  Peter M. Chisnall,et al.  Questionnaire Design, Interviewing and Attitude Measurement , 1993 .

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

[6]  Richard Koch,et al.  The 80/20 Principle: The Secret of Achieving More With Less , 1998 .

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

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

[9]  R. Grissom,et al.  Effect sizes for research: A broad practical approach. , 2005 .

[10]  K. Goulden,et al.  Effect Sizes for Research: A Broad Practical Approach , 2006 .

[11]  Kajal T. Claypool,et al.  XSnippet: mining For sample code , 2006, OOPSLA '06.

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

[13]  Alfred Kobsa,et al.  The Adaptive Web, Methods and Strategies of Web Personalization , 2007, The Adaptive Web.

[14]  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.

[15]  Lerina Aversano,et al.  An empirical study on the maintenance of source code clones , 2010, Empirical Software Engineering.

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

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

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

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

[20]  Ahmed E. Hassan,et al.  Understanding reuse in the Android Market , 2012, 2012 20th IEEE International Conference on Program Comprehension (ICPC).

[21]  Igor Santos,et al.  On the automatic categorisation of android applications , 2012, 2012 IEEE Consumer Communications and Networking Conference (CCNC).

[22]  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).

[23]  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).

[24]  Collin McMillan,et al.  Detecting similar software applications , 2012, 2012 34th International Conference on Software Engineering (ICSE).

[25]  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).

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

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

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

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

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

[31]  Saul Vargas,et al.  Improving sales diversity by recommending users to items , 2014, RecSys '14.

[32]  Jason Nieh,et al.  A measurement study of google play , 2014, SIGMETRICS '14.

[33]  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).

[34]  Paul Klint,et al.  PHP AiR: Analyzing PHP systems with Rascal , 2014, 2014 Software Evolution Week - IEEE Conference on Software Maintenance, Reengineering, and Reverse Engineering (CSMR-WCRE).

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

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

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

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

[39]  Paul Klint,et al.  Modular language implementation in Rascal - experience report , 2015, Sci. Comput. Program..

[40]  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.

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

[42]  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).

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

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

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

[46]  Tommaso Di Noia,et al.  Modification to K-Medoids and CLARA for Effective Document Clustering , 2017, ISMIS.

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

[48]  Fabio Palomba,et al.  A Graph-Based Dataset of Commit History of Real-World Android apps , 2018, 2018 IEEE/ACM 15th International Conference on Mining Software Repositories (MSR).

[49]  Na Meng,et al.  Towards reusing hints from past fixes , 2017, Empirical Software Engineering.

[50]  Paola Inverardi,et al.  An Investigation Into Android Run-Time Permissions from the End Users' Perspective , 2018, 2018 IEEE/ACM 5th International Conference on Mobile Software Engineering and Systems (MOBILESoft).

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

[52]  Massimiliano Di Penta,et al.  FOCUS: A Recommender System for Mining API Function Calls and Usage Patterns , 2019, 2019 IEEE/ACM 41st International Conference on Software Engineering (ICSE).

[53]  Hyoungshick Kim,et al.  Kerberoid: A Practical Android App Decompilation System with Multiple Decompilers , 2019, CCS.

[54]  Alessandro Orso,et al.  Automated API-usage update for Android apps , 2019, ISSTA.

[55]  Beijun Shen,et al.  Lancer: Your Code Tell Me What You Need , 2019, 2019 34th IEEE/ACM International Conference on Automated Software Engineering (ASE).

[56]  Massimiliano Di Penta,et al.  CrossRec: Supporting software developers by recommending third-party libraries , 2020, J. Syst. Softw..

[57]  Juri Di Rocco,et al.  Detecting Java software similarities by using different clustering techniques , 2020, Inf. Softw. Technol..