A Lightweight Api Recommendation Method for App Development Based on Multi-Objective Evolutionary Algorithm

Xun Li,Lei Liu,Yuzhou Liu,Huaxiao Liu
DOI: https://doi.org/10.1016/j.scico.2023.102927
IF: 1.039
2023-01-01
Science of Computer Programming
Abstract:Context: API is important in daily programming activities during app development, but finding appropriate APIs is time-consuming for developers. To simplify this process, many researchers pay attention to overcoming the task-API knowledge gap using semantic information mined from the large-scale dataset for API recommendation. However, only semantic information is not enough since API descriptions and developers' query may not share similar words, meanwhile, large-scale data mining brings high costs. These limit the efficiency of existing API recommendation methods. Objective: In this work, we aim at proposing a lightweight API recommendation method based on small-scale data with low costs, so that everyone can use it obtain appropriate API knowledge for supporting their development tasks. Method: We model API recommendation as a multi-objective optimization problem by considering both structural and semantic information of APIs, and use the genetic algorithm to gain optimal solutions for overcoming the limitations of the small-scale dataset. Specially, we extract the structural and semantic information of APIs from APK files and API descriptions with graph embedding and NLP techniques respectively. Then, we get the recommended APIs satisfying structural and semantic objectives according to the developers' target functionality with a genetic algorithm. Finally, we give the usage scenarios of our recommendation information and the guideline of our approach to help developers understand and use our method easily. Results and Conclusion: We conduct a series of experiments based on apps in Google Play, API descriptions in Android Tutorial and Q&As in Stack Overflow. The results show that Precision@N of our recommendation can be up to 0.89, MAP@N is up to 0.50, and MRR reaches 0.69, and our method achieves such good performance only utilizing less than 1/10 of the project number of our compared machine learning method with less time and lower device requirement. Besides, we conduct a survey and most of the participants confirm the understandability and usability of our recommended APIs in practice.
What problem does this paper attempt to address?