arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 1907.04908cs.SE
收藏

Python代码段在Stack Overflow中的可执行性

Executability of Python Snippets in Stack Overflow

Md Monir Hossain, Nima Mahmoudi, Changyuan Lin, Hamzeh Khazaei, Abram Hindle

摘要:

今天的在线资源包含大量的代码片段,用于文档编制、协作、学习和解决问题。它们以“即插即用”方式的可执行性使我们能够确认它们的质量并直接在项目中使用它们。但是,在实践中,由于几个需求冲突或不完整性,情况往往并非如此。然而,这是一个困难的任务,调查的可执行性在大规模上,由于不同的可能错误在执行过程中。我们已经开发了一个可扩展的框架来研究SOTorrent Python片段。我们发现,经过微小的调整,27.92%的代码片段是可执行的。随着时间的推移,可执行性没有发生重大变化。GitHub中引用的代码片段更有可能是直接可执行的。但可执行性并不显著影响答案被选为可接受答案的机会。这些属性帮助我们理解和改进用户与包含代码段的在线资源的交互。

英文摘要:

Online resources today contain an abundant amount of code snippets for documentation, collaboration, learning, and problem-solving purposes. Their executability in a "plug and play" manner enables us to confirm their quality and use them directly in projects. But, in practice that is often not the case due to several requirements violations or incompleteness. However, it is a difficult task to investigate the executability on a large scale due to different possible errors during the execution. We have developed a scalable framework to investigate this for SOTorrent Python snippets. We found that with minor adjustments, 27.92% of snippets are executable. The executability has not changed significantly over time. The code snippets referenced in GitHub are more likely to be directly executable. But executability does not affect the chances of the answer to be selected as the accepted answer significantly. These properties help us understand and improve the interaction of users with online resources that include code snippets.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑