Code review is widely known as one of the best practices for software quality assurance in software development. In a typical code review process, reviewers check the code committed by developers to ensure the quality of the code, during which reviewers and developers would communicate with each other in review comments to exchange necessary information. As a result, understanding the information in review comments is a prerequisite for reviewers and developers to conduct an effective code review. Code snippet, as a special form of code, can be used to convey necessary information in code reviews. For example, reviewers can use code snippets to make suggestions or elaborate their ideas to meet developers' information needs in code reviews. However, little research has focused on the practices of providing code snippets in code reviews. To bridge this gap, we conduct a mixed-methods study to mine information and knowledge related to code snippets in code reviews, which can help practitioners and researchers get a better understanding about using code snippets in code review. Specifically, our study includes two phases: mining code review data and conducting practitioners' survey. The study results highlight that reviewers can provide code snippets in appropriate scenarios to meet developers' specific information needs in code reviews, which will facilitate and accelerate the code review process.
翻译:代码审查被广泛认为是软件开发中保障软件质量的最佳实践之一。在典型的代码审查过程中,审查者检查开发者提交的代码以确保代码质量,期间审查者与开发者通过审查评论进行沟通以交换必要信息。因此,理解审查评论中的信息是审查者和开发者进行有效代码审查的前提。代码片段作为代码的特殊形式,可用于在代码审查中传递必要信息。例如,审查者可借助代码片段提出建议或阐述观点,以满足开发者在代码审查中的信息需求。然而,目前鲜有研究聚焦于代码片段在代码审查中的实践。为弥补这一空白,我们采用混合研究方法挖掘代码审查中与代码片段相关的信息和知识,从而帮助从业者和研究者更深入理解代码片段在代码审查中的应用。具体而言,本研究包含两个阶段:挖掘代码审查数据与开展从业者调查。研究结果表明,审查者可在适当场景下提供代码片段以满足开发者在代码审查中的特定信息需求,这将促进并加速代码审查流程。