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.
翻译:代码评审被广泛认为是软件开发中保障软件质量的最佳实践之一。在典型的代码评审过程中,评审者检查开发者提交的代码以确保代码质量,期间评审者与开发者会通过评审评论进行沟通以交换必要信息。因此,理解评审评论中的信息是评审者与开发者开展有效代码评审的前提。代码片段作为一种特殊形式的代码,可用于在代码评审中传递必要信息。例如,评审者可利用代码片段提出建议或阐述观点,以满足开发者在代码评审中的信息需求。然而,目前鲜有研究聚焦于代码评审中提供代码片段的实践。为填补这一空白,我们采用混合方法研究,挖掘代码评审中与代码片段相关的信息与知识,帮助从业者与研究者更深入地理解代码片段在代码评审中的应用。具体而言,本研究包含两个阶段:挖掘代码评审数据与开展从业者调查。研究结果表明,评审者可在适当场景下提供代码片段,以满足开发者在代码评审中的特定信息需求,从而促进并加速代码评审流程。