Exempla Gratis (E.G.): Code Examples for Free
Celeste Barnaby, Koushik Sen, Tianyi Zhang, Elena Glassman, and Satish Chandra

TL;DR
The paper introduces EG, a tool that mines codebases to generate high-quality, idiomatic API usage examples, improving developer understanding and documentation efficiency.
Contribution
EG is a novel tool that automatically extracts and presents representative API usage examples from large codebases, reducing manual effort and enhancing example quality.
Findings
EG produces more succinct examples than existing sources.
Developers prefer EG examples in 97% of cases.
EG effectively identifies idiomatic API usage patterns.
Abstract
Modern software engineering often involves using many existing APIs, both open source and, in industrial coding environments, proprietary. Programmers reference documentation and code search tools to remind themselves of proper common usage patterns of APIs. However, high-quality API usage examples are computationally expensive to curate and maintain, and API usage examples retrieved from company-wide code search can be tedious to review. We present a tool, EG, that mines codebases and shows the common, idiomatic usage examples for API methods. EG was integrated into Facebook's internal code search tool for the Hack language and evaluated on open-source GitHub projects written in Python. EG was also compared against code search results and hand-written examples from a popular programming website called ProgramCreek. Compared with these two baselines, examples generated by EG are more…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
