arXivDaily arXiv每日学术速递 周一至周五更新
北美退伍军人节(Veterans Day),12 日无更新
arXiv 2109.01138cs.SE
收藏

API化:从StackOverflow代码段生成可重用的API

APIzation: Generating Reusable APIs from StackOverflow Code Snippets

Valerio Terragni, Pasquale Salza

摘要:

像StackOverflow这样的开发者论坛已经成为现代软件开发实践的重要资源。然而,许多代码片段缺乏定义良好的方法声明,因此它们通常不完整,无法立即重用。开发人员必须通过参数化所涉及的变量并标识返回值来调整检索到的代码片段。这个活动,我们称之为代码段的API化,可能是乏味和耗时的。在本文中,我们提出了APIzator自动执行的Java代码片段的APIzations。APIzator基于我们通过研究GitHub中的真实APIzations提取的四种常见模式。APIzator提供了一种静态分析算法,可以自动提取方法参数和返回语句。我们使用从20个开发人员收集的200个APIzations的地面事实来评估APIzator。对于113个(56.50%)和115个(57.50%)APIzation,APIzator和开发人员分别提取了相同的参数和返回语句。对于163个(81.50%)API,参数或返回语句相同。

英文摘要:

Developer forums like StackOverflow have become essential resources to modern software development practices. However, many code snippets lack a well-defined method declaration, and thus they are often incomplete for immediate reuse. Developers must adapt the retrieved code snippets by parameterizing the variables involved and identifying the return value. This activity, which we call APIzation of a code snippet, can be tedious and time-consuming. In this paper, we present APIzator to perform APIzations of Java code snippets automatically. APIzator is grounded by four common patterns that we extracted by studying real APIzations in GitHub. APIzator presents a static analysis algorithm that automatically extracts the method parameters and return statements. We evaluated APIzator with a ground-truth of 200 APIzations collected from 20 developers. For 113 (56.50 %) and 115 (57.50 %) APIzations, APIzator and the developers extracted identical parameters and return statements, respectively. For 163 (81.50 %) APIzations, either the parameters or the return statements were identical.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑