论文标题

免费示例(例如):免费的代码示例

Exempla Gratis (E.G.): Code Examples for Free

论文作者

Barnaby, Celeste, Sen, Koushik, Zhang, Tianyi, Glassman, Elena, Chandra, Satish

论文摘要

现代软件工程通常涉及使用许多现有的API,无论是开源的,并且在工业编码环境中,专有。程序员参考文献文档和代码搜索工具,以提醒自己适当的常见API使用模式。但是,高质量的API使用示例在计算上的策划和维护量很高,并且从公司范围的代码搜索中检索到的API使用示例可能很繁琐。我们提出了一个工具,例如,该工具矿山代码库,并显示了API方法的常见,惯用的用法示例。例如,将Hack语言的Facebook内部代码搜索工具集成到了Facebook的内部代码搜索工具中,并根据Python编写的开源GitHub项目进行了评估。还将EG与代码搜索结果和名为ProgramCreek的流行编程网站的手写示例进行了比较。与这两个基线相比,例如,EG产生的示例更为简洁,代表性较小。此外,与Facebook开发人员进行的一项调查显示,在97%的案件中,EG示例是优选的。

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 succinct and representative with less extraneous statements. In addition, a survey with Facebook developers shows that EG examples are preferred in 97 percent of cases.

扫码加入交流群

加入微信交流群

微信交流群二维码

扫码加入学术交流群,获取更多资源