APIzation: Generating Reusable APIs from StackOverflow Code Snippets

被引:7
作者
Terragni, Valerio [1 ]
Salza, Pasquale [2 ]
机构
[1] Univ Auckland, Auckland, New Zealand
[2] Univ Zurich, Zurich, Switzerland
来源
2021 36TH IEEE/ACM INTERNATIONAL CONFERENCE ON AUTOMATED SOFTWARE ENGINEERING ASE 2021 | 2021年
关键词
APIs; software reuse; code snippets; StackOverflow; GitHub; program analysis; program synthesis; STACK; SEARCH;
D O I
10.1109/ASE51524.2021.9678576
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
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.
引用
收藏
页码:542 / 554
页数:13
相关论文
共 63 条
[11]   GROUNDED THEORY RESEARCH - PROCEDURES, CANONS AND EVALUATIVE CRITERIA [J].
CORBIN, J ;
STRAUSS, A .
ZEITSCHRIFT FUR SOZIOLOGIE, 1990, 19 (06) :418-427
[12]  
Explosion, 2020, SPACY
[13]  
Falleri J-R, 2014, P 29 ACM IEEE INT C, P313, DOI DOI 10.1145/2642937.2642982
[14]   A Neural Model for Method Name Generation from Functional Description [J].
Gao, Sa ;
Chen, Chunyang ;
Xing, Zhenchang ;
Ma, Yukun ;
Song, Wen ;
Lin, Shang-Wei .
2019 IEEE 26TH INTERNATIONAL CONFERENCE ON SOFTWARE ANALYSIS, EVOLUTION AND REENGINEERING (SANER), 2019, :411-421
[15]   Generating Question Titles for Stack Overflow from Mined Code Snippets [J].
Gao, Zhipeng ;
Xia, Xin ;
Grundy, John ;
Lo, David ;
Li, Yuan-Fang .
ACM TRANSACTIONS ON SOFTWARE ENGINEERING AND METHODOLOGY, 2020, 29 (04)
[16]   Some From Here, Some From There: Cross-Project Code Reuse in GitHub [J].
Gharehyazie, Mohammad ;
Ray, Baishakhi ;
Filkov, Vladimir .
2017 IEEE/ACM 14TH INTERNATIONAL CONFERENCE ON MINING SOFTWARE REPOSITORIES (MSR 2017), 2017, :291-301
[17]  
Google, 2020, GOOGL BIGQUERY
[18]   StackInTheFlow: Behavior-Driven Recommendation System for Stack Overflow Posts [J].
Greco, Chase ;
Haden, Tyler ;
Damevski, Kostadin .
PROCEEDINGS 2018 IEEE/ACM 40TH INTERNATIONAL CONFERENCE ON SOFTWARE ENGINEERING - COMPANION (ICSE-COMPANION, 2018, :5-8
[19]   Systematizing Pragmatic Software Reuse [J].
Holmes, Reid ;
Walker, Robert J. .
ACM TRANSACTIONS ON SOFTWARE ENGINEERING AND METHODOLOGY, 2012, 21 (04)
[20]   Statistical Learning of API Fully Qualified Names in Code Snippets of Online Forums [J].
Hung Phan ;
Hoan Anh Nguyen ;
Tran, Ngoc M. ;
Truong, Linh H. ;
Anh Tuan Nguyen ;
Nguyen, Tien N. .
PROCEEDINGS 2018 IEEE/ACM 40TH INTERNATIONAL CONFERENCE ON SOFTWARE ENGINEERING (ICSE), 2018, :632-642