首页> 外文会议>IEEE/ACM International Conference on Mining Software Repositories >Impact of Stack Overflow Code Snippets on Software Cohesion: A Preliminary Study
【24h】

Impact of Stack Overflow Code Snippets on Software Cohesion: A Preliminary Study

机译:堆栈溢出代码片段对软件凝聚力的影响:初步研究

获取原文

摘要

Developers frequently copy code snippets from publicly-available resources such as Stack Overflow (SO). While this may lead to a 'quick fix' for a development problem, little is known about how these copied code snippets affect the code quality of the recipient application, or how the quality of the recipient classes subsequently evolve over the time of the project. This has an impact on whether such code copying should be encouraged, and how classes that receive such code snippets should be monitored during evolution. To investigate this issue, we used instances from the SOTorrent database where Java snippets had been copied from Stack Overflow into GitHub projects. In each case, we measured the quality of the recipient class just prior to the addition of the snippet, immediately after the addition of the snippet, and at a later stage in the project. Our goal was to determine if the addition of the snippet caused quality to improve or deteriorate, and what the long-term implications were for the quality of the recipient class. Code quality was measured using the cohesion metrics Low-level Similarity-based Class Cohesion (LSCC) and Class Cohesion (CC). Over a random sample of 378 classes that received code snippets copied from Stack Overflow to GitHub, we found that in almost 70% of the cases where the copied snippet affected cohesion, the effect was to reduce the cohesion of the recipient class. Furthermore, this deterioration in cohesion tends to persist in the subsequent evolution of the recipient class. In over 70% of cases the recipient class never fully regained the cohesion it lost in receiving the snippet. These results suggest that when copying code snippets from external repositories, more attention should be paid to integrating the code with the recipient class.
机译:开发人员经常从公开的资源中复制代码片段,例如堆栈溢出(SO)。虽然这可能导致开发问题的“快速修复”,但是讨论了这些复制的代码片段如何影响收件人应用程序的代码质量,或者接收类类的质量随后如何在项目的时间内发展。这对应鼓励是否应鼓励这种代码复制以及如何在演变期间监控此类代码片段的课程。要调查此问题,我们将从Sotorrent数据库中使用实例,其中从堆栈溢出到Github项目中复制了Java片段。在每种情况下,我们在添加代码段后立即在添加片段之前测量接收者类的质量,并在项目的后期阶段。我们的目标是确定片段的添加是否导致质量改善或恶化,并且长期影响是针对收件人类的质量。使用基于凝聚率的基于低级相似性的凝聚(LSCC)和级凝聚(CC)测量代码质量。在378个类的随机样本中,从堆栈溢出到GitHub中收到的代码片段,我们发现,在近70%的情况下,复制的片段受影响的凝聚力,效果是减少收件人类的凝聚力。此外,在接受者阶级的随后的进化中趋于持续存在这种在内聚力的劣化。在超过70%的情况下,收件人课程从未完全重新恢复过粘的凝聚力。这些结果表明,当从外部存储库复制代码片段时,应将更多的注意与收件人类集成到集成代码。

著录项

相似文献

  • 外文文献
  • 中文文献
  • 专利
获取原文

客服邮箱:kefu@zhangqiaokeyan.com

京公网安备:11010802029741号 ICP备案号:京ICP备15016152号-6 六维联合信息科技 (北京) 有限公司©版权所有
  • 客服微信

  • 服务号