TY - GEN
T1 - Automatic parameter recommendation for practical API usage
AU - Zhang, Cheng
AU - Yang, Juyuan
AU - Zhang, Yi
AU - Fan, Jing
AU - Zhang, Xin
AU - Zhao, Jianjun
AU - Ou, Peizhao
PY - 2012
Y1 - 2012
N2 - Programmers extensively use application programming interfaces (APIs) to leverage existing libraries and frameworks. However, correctly and efficiently choosing and using APIs from unfamiliar libraries and frameworks is still a non-trivial task. Programmers often need to ruminate on API documentations (that are often incomplete) or inspect code examples (that are often absent) to learn API usage patterns. Recently, various techniques have been proposed to alleviate this problem by creating API summarizations, mining code examples, or showing common API call sequences. However, few techniques focus on recommending API parameters. In this paper, we propose an automated technique, called Precise, to address this problem. Differing from common code completion systems, Precise mines existing code bases, uses an abstract usage instance representation for each API usage example, and then builds a parameter usage database. Upon a request, Precise queries the database for abstract usage instances in similar contexts and generates parameter candidates by concretizing the instances adaptively. The experimental results show that our technique is more general and applicable than existing code completion systems, specially, 64% of the parameter recommendations are useful and 53% of the recommendations are exactly the same as the actual parameters needed. We have also performed a user study to show our technique is useful in practice.
AB - Programmers extensively use application programming interfaces (APIs) to leverage existing libraries and frameworks. However, correctly and efficiently choosing and using APIs from unfamiliar libraries and frameworks is still a non-trivial task. Programmers often need to ruminate on API documentations (that are often incomplete) or inspect code examples (that are often absent) to learn API usage patterns. Recently, various techniques have been proposed to alleviate this problem by creating API summarizations, mining code examples, or showing common API call sequences. However, few techniques focus on recommending API parameters. In this paper, we propose an automated technique, called Precise, to address this problem. Differing from common code completion systems, Precise mines existing code bases, uses an abstract usage instance representation for each API usage example, and then builds a parameter usage database. Upon a request, Precise queries the database for abstract usage instances in similar contexts and generates parameter candidates by concretizing the instances adaptively. The experimental results show that our technique is more general and applicable than existing code completion systems, specially, 64% of the parameter recommendations are useful and 53% of the recommendations are exactly the same as the actual parameters needed. We have also performed a user study to show our technique is useful in practice.
UR - http://www.scopus.com/inward/record.url?scp=84864211699&partnerID=8YFLogxK
UR - http://www.scopus.com/inward/citedby.url?scp=84864211699&partnerID=8YFLogxK
U2 - 10.1109/ICSE.2012.6227136
DO - 10.1109/ICSE.2012.6227136
M3 - Conference contribution
AN - SCOPUS:84864211699
SN - 9781467310673
T3 - Proceedings - International Conference on Software Engineering
SP - 826
EP - 836
BT - Proceedings - 34th International Conference on Software Engineering, ICSE 2012
T2 - 34th International Conference on Software Engineering, ICSE 2012
Y2 - 2 June 2012 through 9 June 2012
ER -