一句话:通过 85 人对照实验表明,代码评审中已有评论并非负向启动,而是对易忽略 bug 的正向提醒。
在代码评审中,已有评审评论对所有评审者可见,可能因可得性偏差启动新评审者的注意并偏向评审结果。本文通过 85 名开发者参与的对照实验,结合心理实验与代码评审任务,考察评论可见性是否引发启动效应。结果显示,约 70% 参与者易受可得性偏差影响;但在代码评审中,仅当已有评论涉及通常不被考虑的 bug 类型时才会出现启动效应,使参与者更可能发现同类 bug 的另一处出现,而对发现其他类型 bug 无显著影响。结论是当前评审实践有效,因为关于代码变更中 bug 的评论更像正向提醒,而非负向启动。
In contemporary code review, the comments put by reviewers on a specific code change are immediately visible to the other reviewers involved. Could this visibility prime new reviewers' attention (due to the human's proneness to availability bias), thus biasing the code review outcome? In this study, we investigate this topic by conducting a controlled experiment with 85 developers who perform a code review and a psychological experiment. With the psychological experiment, we find that ≈70% of participants are prone to availability bias. However, when it comes to the code review, our experiment results show that participants are primed only when the existing code review comment is about a type of bug that is not normally considered; when this comment is visible, participants are more likely to find another occurrence of this type of bug. Moreover, this priming effect does not influence reviewers' likelihood of detecting other types of bugs. Our findings suggest that the current code review practice is effective because existing review comments about bugs in code changes are not negative primers, rather positive reminders for bugs that would otherwise be overlooked during code review. Data and materials: https://doi.org/10.5281/zenodo.3653856