Are code examples on an online Q&A forum reliable?: a study of API misuse on stack overflow
Open accessThe DOI matches its Crossref record; 34 of the 34 references it cites were found in a registry or an index.
Abstract
Programmers often consult an online Q&A forum such as Stack Overflow to learn new APIs. This paper presents an empirical study on the prevalence and severity of API misuse on Stack Overflow. To reduce manual assessment effort, we design ExampleCheck, an API usage mining framework that extracts patterns from over 380K Java repositories on GitHub and subsequently reports potential API usage violations in Stack Overflow posts. We analyze 217,818 Stack Overflow posts using ExampleCheck and find that 31% may have potential API usage violations that could produce unexpected behavior such as program crashes and resource leaks. Such API misuse is caused by three main reasons---missing control constructs, missing or incorrect order of API calls, and incorrect guard conditions. Even the posts that are accepted as correct answers or upvoted by other programmers are not necessarily more reliable than other posts in terms of API misuse. This study result calls for a new approach to augment Stack Overflow with alternative API usage details that are not typically shown in curated examples.
Overview
The claims and statistics of this paper haven’t been checked yet.
Free: it reads the open-access text and checks the first 5 claims that cite a source we can check. Create a free account to check every claim.
Integrity signals
Registry
Cites
Statistics
Verification
Claims the paper makes
The claims and statistics of this paper haven’t been checked yet.
Free: it reads the open-access text and checks the first 5 claims that cite a source we can check. Create a free account to check every claim.
Self-check
Percentages, sums and reported differences re-computed from the paper’s own numbers.
The self-check needs the paper’s full text.
Citations
Cites
(2005) · PubMed · Cited by 7,011
de Moura, L., & Bjørner, N. (2008) · Lecture Notes in Computer Science · doi:10.1007/978-3-540-78800-3_24 · Cited by 6,595 · cited 2×
“In order to accurately estimate the frequency of unique guard conditions, ExampleCheck uses a SMT solver, Z3 [6], to check the semantic equivalence of guard conditions, instead of considering the syntactic similarity between them only.”
MethodFormal Concept Analysis: Mathematical Foundations
Ganter, B., Wille, R., & Franzke, C. (1998) · CERN Document Server (European Organization for Nuclear Research) · Cited by 4,245
Dynamically discovering likely program invariants to support program evolution
Ernst, M. D., Cockrell, J., Griswold, W. G., & Notkin, D. (2001) · IEEE Transactions on Software Engineering · doi:10.1109/32.908957 · Cited by 1,050
Allen, F. E. (1970) · ACM SIGPLAN Notices · doi:10.1145/390013.808479 · Cited by 738
Weiser, M. (1981) · doi:10.5555/800078.802557 · Cited by 695
Ammons, G., Bodík, R., & Larus, J. R. (2002) · Proceedings of the 29th ACM SIGPLAN-SIGACT symposium on Principles of programming languages · doi:10.1145/503272.503275 · Cited by 665 · cited 1×
“Many other specification mining techniques are dedicated to inferring temporal properties of API calls [3, 9, 11, 21, 22, 36].”
BackgroundEfficiently Using Prefix-trees in Mining Frequent Itemsets.
Grahne, G., & Zhu, J. (2003) · Cited by 457
Li, Z., & Zhou, Y. (2005) · Proceedings of the 10th European software engineering conference held jointly with 13th ACM SIGSOFT international symposium on Foundations of software engineering · doi:10.1145/1081706.1081755 · Cited by 428 · cited 1×
“Several techniques [17, 18, 29] model programs as item sets and infer pairwise programming rules using frequent itemset mining [14], which does not consider temporal ordering or guard conditions of API calls.”
MethodMAPO: Mining and Recommending API Usage Patterns
Zhong, H., Xie, T., Zhang, L., Pei, J., & Mei, H. (2009) · Lecture Notes in Computer Science · doi:10.1007/978-3-642-03013-0_15 · Cited by 410 · cited 1×
“Computing the common subsequence is widely practiced in the literature of API usage mining [27, 28, 34, 40] and has the benefit of filtering out API calls pertinent to only a few outlier examples.”
Background
Cited by
Using an LLM to Help With Code Understanding
Nam, D., Macvean, A., Hellendoorn, V., Vasilescu, B., & Myers, B. (2024) · Proceedings of the IEEE/ACM 46th International Conference on Software Engineering · doi:10.1145/3597503.3639187 · Cited by 487
Bugs in Large Language Models Generated Code: An Empirical Study
Tambon, F., Dakhel, A. M., Nikanjam, A., Khomh, F., Desmarais, M. C., & Antoniol, G. (2024) · arXiv · doi:10.48550/arxiv.2403.08937 · Cited by 70
Understanding How Programmers Can Use Annotations on Documentation
Horvath, A., Liu, M. X., Hendriksen, R., Shannon, C., Paterson, E., Jawad, K., Macvean, A., & Myers, B. A. (2022) · CHI Conference on Human Factors in Computing Systems · doi:10.1145/3491102.3502095 · Cited by 26
“However, there is signifcant evidence that APIs are often difcult to use [19, 42, 50], which can cause APIs to be used incorrectly, resulting in bugs and sometimes signifcant security problems [22, 58].”
BackgroundEnabling Data-Driven API Design with Community Usage Data: A Need-Finding Study
Zhang, T., Hartmann, B., Kim, M., & Glassman, E. L. (2020) · Proceedings of the 2020 CHI Conference on Human Factors in Computing Systems · doi:10.1145/3313831.3376382 · Cited by 25
“Making mistakes in API usage could lead to severe program failures such as runtime exceptions [60] and security vulnerabilities [21, 18, 16].”
BackgroundMethodInfluentialSelf-citationMARBLE: Mining for Boilerplate Code to Identify API Usability Problems
Nam, D., Horvath, A., Macvean, A., Myers, B., & Vasilescu, B. (2019) · 2019 34th IEEE/ACM International Conference on Automated Software Engineering (ASE) · doi:10.1109/ase.2019.00063 · Cited by 19
A disruptive research playbook for studying disruptive innovations
Storey, M.-A., Russo, D., Novielli, N., Kobayashi, T., & Wang, D. (2024) · ACM Transactions on Software Engineering and Methodology · doi:10.1145/3678172 · Cited by 15
Metadata
- Authors
- Zhang, T., Upadhyaya, G., Reinhardt, A., Rajan, H., & Kim, M.
- Venue
- Proceedings of the 40th International Conference on Software Engineering
- Publisher
- ACM
- Published
- 2018-05-27
- Pages
- 886-896
- ISSN
- 0270-5257 (ISSN-L)
- OpenAlex
- W2794992746
- Cited by
- 167
- References
- 34
- FWCI
- 15.95
- Type
- conference paper
- Language
- en
- Open access
- bronze
About these checks
Registry, retraction, Cites and statistics results are computed, not judged, with one exception: a printed reference that no index lists is read once by a model before it counts as a citation error. Claims are extracted by a model and kept only when their quote appears verbatim in the text; each cited source is then checked, with a model’s help, for whether it says what the claim relies on. Those verdicts can be wrong — read the claim’s quote and the cited source before relying on one.
Statistics and arithmetic are recomputed, not judged.
Confidence bands are shown only for fields calibrated on our annotated test set. None is calibrated yet, so no band is shown.
What counts as a claim ›How we measure confidence ›How we check this ›
Are you an author, or do you see a problem with this page? Request a review
Data sources
Bibliographic data: Semantic Scholar, OpenAlex, Crossref.
Contains information from the Semantic Scholar Academic Graph Datasets, made available under the ODC Attribution License (ODC-BY 1.0).
Semantic Scholar’s data is described in: Kinney, R., et al. (2023). The Semantic Scholar Open Data Platform. arXiv:2301.10140.