Automatic parameter recommendation for practical API usage

Cheng Zhang, Juyuan Yang, Yi Zhang, Jing Fan, Xin Zhang, Jianjun Zhao, Peizhao Ou

Research output: Chapter in Book/Report/Conference proceedingConference contribution

55 Citations (Scopus)

Abstract

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.

Original languageEnglish
Title of host publicationProceedings - 34th International Conference on Software Engineering, ICSE 2012
Pages826-836
Number of pages11
DOIs
Publication statusPublished - Jul 30 2012
Event34th International Conference on Software Engineering, ICSE 2012 - Zurich, Switzerland
Duration: Jun 2 2012Jun 9 2012

Publication series

NameProceedings - International Conference on Software Engineering
ISSN (Print)0270-5257

Other

Other34th International Conference on Software Engineering, ICSE 2012
CountrySwitzerland
CityZurich
Period6/2/126/9/12

    Fingerprint

All Science Journal Classification (ASJC) codes

  • Software

Cite this

Zhang, C., Yang, J., Zhang, Y., Fan, J., Zhang, X., Zhao, J., & Ou, P. (2012). Automatic parameter recommendation for practical API usage. In Proceedings - 34th International Conference on Software Engineering, ICSE 2012 (pp. 826-836). [6227136] (Proceedings - International Conference on Software Engineering). https://doi.org/10.1109/ICSE.2012.6227136