arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 1609.03614cs.SE
收藏

少即是多:使用XTREE最小化代码重组

Less is More: Minimizing Code Reorganization using XTREE

Rahul Krishna, Tim Menzies, Lucas Layman

摘要:

上下文:开发人员使用糟糕的代码气味来指导代码重组。然而,开发人员、教科书、工具和研究人员对哪些难闻的气味是重要的意见不一。目的:评估代码重组以解决不良代码气味将改善代码缺陷倾向的可能性。方法:我们引入了XTREE,这是一个工具,它分析了代码中以前看到的缺陷的历史日志,并生成了一组有用的代码更改。任何需要在该集合之外进行更改的难闻气味都可以降低优先级(因为没有历史证据表明难闻气味会导致任何问题)。评价:我们评估XTREE的建议,从以前的工作(Shatnawi,阿尔维斯和博尔赫斯)使用多个数据集的代码度量和缺陷计数的建议,改善难闻的气味。结果如下:响应Xtree建议而更改的代码模块包含的缺陷比以前研究的建议少得多。此外,XTREE支持对很少的代码度量进行更改,并且难闻气味建议(从以前的研究中学习)并不适用于所有软件项目。结论:在基于坏气味报告进行代码重组之前,使用像Xtree这样的工具来检查并忽略任何无用的操作;即在历史记录中缺乏证据表明进行更改是有用的。请注意,此用例既适用于开发人员提出的手动代码重组,也适用于由自动方法执行的代码重组。本建议假定存在历史记录。如果不存在,那么本文的结果可以作为指导。

英文摘要:

Context: Developers use bad code smells to guide code reorganization. Yet developers, text books, tools, and researchers disagree on which bad smells are important. Objective: To evaluate the likelihood that a code reorganization to address bad code smells will yield improvement in the defect-proneness of the code. Method: We introduce XTREE, a tool that analyzes a historical log of defects seen previously in the code and generates a set of useful code changes. Any bad smell that requires changes outside of that set can be deprioritized (since there is no historical evidence that the bad smell causes any problems). Evaluation: We evaluate XTREE's recommendations for bad smell improvement against recommendations from previous work (Shatnawi, Alves, and Borges) using multiple data sets of code metrics and defect counts. Results: Code modules that are changed in response to XTREE's recommendations contain significantly fewer defects than recommendations from previous studies. Further, XTREE endorses changes to very few code metrics, and the bad smell recommendations (learned from previous studies) are not universal to all software projects. Conclusion: Before undertaking a code reorganization based on a bad smell report, use a tool like XTREE to check and ignore any such operations that are useless; i.e. ones which lack evidence in the historical record that it is useful to make that change. Note that this use case applies to both manual code reorganizations proposed by developers as well as those conducted by automatic methods. This recommendation assumes that there is an historical record. If none exists, then the results of this paper could be used as a guide.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑