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

从错误中学习:通过分析意外提交理解临时日志

Learning from Mistakes: Understanding Ad-hoc Logs through Analyzing Accidental Commits

Yi-Hung Chou, Yiyang Min, April Yi Wang, James A. Jones

AI总结:

本文通过分析意外提交和直播编码视频,研究开发人员使用临时日志的实践,收集27GB数据揭示其在异步函数中的使用倾向,为改进相关实践提供实证与数据集。

摘要:

开发人员经常在代码中插入临时的“print”或“log”指令,以帮助他们更好地理解运行时行为,通常是在代码未按预期运行时。尽管此类监控指令(即“临时日志”)被开发人员广泛使用,但几乎没有现有文献研究开发人员使用它们的实践。对这些临时日志使用情况的知识匮乏,很大程度上是因为它们通常只存在于开发人员的本地环境中,并在提交代码到版本控制系统之前被删除。在这项工作中,我们通过观察开发人员偶尔会在提交前错误地忘记删除此类指令,然后在不久后将其删除,从而克服了这一挑战。此外,我们通过观看和分析直播编码视频,进一步研究了开发人员的日志记录实践。通过这些实证方法,我们研究了开发人员在何处、如何以及为何使用临时日志来更好地理解其代码及其执行。我们从GitHub Archive存储库中收集了27 GB的意外提交,这些提交删除了JavaScript中的548,880条临时日志,为临时日志记录实践提供了首个大规模数据集和实证研究。我们的结果揭示了一些具有启发性的发现,包括开发人员特别倾向于在异步和回调函数中使用临时日志。我们的发现为寻求改进临时日志记录实践的研究人员和工具开发人员提供了实证证据和宝贵的数据集,并可能加深我们对开发人员理解软件运行时行为实践的理解。

英文摘要:

Developers often insert temporary "print" or "log" instructions into their code to help them better understand runtime behavior, usually when the code is not behaving as they expected. Despite the fact that such monitoring instructions, or "ad-hoc logs," are so commonly used by developers, there is almost no existing literature that studies developers' practices in how they use them. This paucity of knowledge of the use of these ephemeral logs may be largely due to the fact that they typically only exist in the developers' local environments and are removed before they commit their code to their revision control system. In this work, we overcome this challenge by observing that developers occasionally mistakenly forget to remove such instructions before committing, and then they remove them shortly later. Additionally, we further study such developer logging practices by watching and analyzing live-streamed coding videos. Through these empirical approaches, we study where, how, and why developers use ad-hoc logs to better understand their code and its execution. We collect 27 GB of accidental commits that removed 548,880 ad-hoc logs in JavaScript from GitHub Archive repositories to provide the first large-scale dataset and empirical studies on ad-hoc logging practices. Our results reveal several illuminating findings, including a particular propensity for developers to use ad-hoc logs in asynchronous and callback functions. Our findings provide both empirical evidence and a valuable dataset for researchers and tool developers seeking to enhance ad-hoc logging practices, and potentially deepen our understanding of developers' practices towards understanding of software's runtime behaviors.

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

↑