Code review is a key development practice that contributes to improve software quality and to foster knowledge sharing among developers. However, code review usually takes time and demands detailed and time-consuming analysis of textual diffs. Particularly, detecting refactorings during code reviews is not a trivial task, since they are not explicitly represented in diffs. For example, a Move Function refactoring is represented by deleted (-) and added lines (+) of code which can be located in different and distant source code files. To tackle this problem, we introduce RAID, a refactoring-aware and intelligent diff tool. Besides proposing an architecture for RAID, we implemented a Chrome browser plug-in that supports our solution. Then, we conducted a field experiment with eight professional developers who used RAID for three months. We concluded that RAID can reduce the cognitive effort required for detecting and reviewing refactorings in textual diff. Besides documenting refactorings in diffs, RAID reduces the number of lines required for reviewing such operations. For example, the median number of lines to be reviewed decreases from 14.5 to 2 lines in the case of move refactorings and from 113 to 55 lines in the case of extractions.
翻译:代码审查是一项关键的开发实践,有助于提高软件质量,促进开发者之间的知识共享。然而,代码审查通常需要时间,需要详细和费时地对文本 diffs 进行详细分析。特别是,在代码审查过程中发现再设置要素并非一项微不足道的任务,因为它们在 diffs 中没有明确体现。例如,移动函数再设置要素代表的代码删除(-)和添加行(+),这些代码可以存放在不同和遥远源代码文档中。为了解决这一问题,我们引入了RAID,这是一个重新设置识别和智能的 diff 工具。除了为 RAID提议一个结构外,我们还安装了一个支持我们解决方案的Chrome浏览器插件。然后,我们与八个专业开发者进行了实地实验,这些开发者使用了RAID 3个月。我们的结论是,RAID可以减少在文本 diffs 中为检测和审查再设置代码所需的认知努力。除了记录 diffs 中的再设置参数外,RAID还减少了审查此类操作所需的线数。例如,要审查的行中位数从14.5到 113 的提取第11行,要从55行减少到。