API Recommendation for Novice Programmers: Build a Bridge of Query-Task Knowledge Gap
Yong Wang,Yingtao Fang,Cuiyun Gao,Linjun Chen
DOI: https://doi.org/10.1109/tr.2024.3361922
IF: 5.883
2024-01-01
IEEE Transactions on Reliability
Abstract:During software development, programmers often rely on a wide range of application programming interfaces (APIs) to facilitate their tasks. However, APIs have been growing rapidly in recent years, making it difficult for developers to choose among the many APIs that suit their programming needs. To facilitate the development process, automatic API recommendation is becoming increasingly important. Although there have been many effective research methods, these methods have a high dependence on the accuracy of the user's description of his own task, and there is a knowledge difference between the user's query and the user's actual task, increasing the difficulty of accurate API recommendation. In this article, we propose REAPI, a method to bridge the knowledge gap between the user's query and the user's actual task to improve the recommendation accuracy. The REAPI approach involves reconstructing query by tapping into Stack Overflow data to glean user intentions. Refactoring the user's query to display implicit information can better capture the user's true intentions. Specifically, we generate three candidate reconstruction statements based on natural language queries and Stack Overflow data and incorporate user feedback to refine and select the final statement. To evaluate the effectiveness of REAPI, we conducted experiments at both the class-level and method-level. Our results show that REAPI outperforms state-of-the-art baselines across key evaluation metrics such as S@1, S@3, S@10, MRR, and MAP.