arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2411.01012cs.SE
收藏

PairSmell: 一种审视软件模块化结构的新视角

PairSmell: A Novel Perspective Inspecting Software Modular Structure

Chenxing Zhong, Daniel Feitosa, Paris Avgeriou, Huang Huang, Yue Li, He Zhang

AI总结:

本研究提出PairSmell新概念,结合模块化技术从细粒度模块关系维度定位需重构的设计问题,通过20个项目的实证验证了其识别有损软件质量模块化结构的有效性。

摘要:

增强现有系统的模块化结构已吸引了大量研究兴趣,研究主要聚焦于两类方法:(1)软件模块化,以及(2)识别设计问题(例如代码坏味)作为重构机会。然而,重新模块化的解决方案通常需要对原有模块进行大量修改,而识别出的设计问题普遍过于粗粒度,无法指导重构策略。结合上述两类方法,本文提出了一个新概念PairSmell,该概念利用模块化技术来精准定位需要重构的设计问题。我们聚焦于模块化原则中一个细粒度但基础性的维度——模块关系(modular relation, MR),即一对实体是分离放置还是并置放置。核心假设是:如果一对实体的实际MR违反了其“适宜MR”(即由多个模块化工具作为评估者达成一致的MR),则可认为这可能是一个存在缺陷的架构决策,需要进一步审查。为量化和评估PairSmell,我们针对20个C/C++和Java项目开展了实证研究,使用4种成熟的模块化工具识别两种形式的PairSmell:不适宜分离对(inapt separated pairs, InSep)和不适宜并置对(inapt collocated pairs, InCol)。我们对260003个实例的研究表明,它们的架构影响十分显著:(1)平均而言,分别有14.60%和20.44%的软件实体涉及InSep和InCol类型的MR;(2)InSep对的共同变更次数比合理分离对多190%,而InCol对的共同变更次数比合理并置对少35%,这两点均表明该方法成功识别了有损软件质量的模块化结构;(3)两种形式的PairSmell都会在软件演化过程中持续存在。

英文摘要:

Enhancing the modular structure of existing systems has attracted substantial research interest, focusing on two main methods: (1) software modularization and (2) identifying design issues (e.g., smells) as refactoring opportunities. However, re-modularization solutions often require extensive modifications to the original modules, and the design issues identified are generally too coarse to guide refactoring strategies. Combining the above two methods, this paper introduces a novel concept, PairSmell, which exploits modularization to pinpoint design issues necessitating refactoring. We concentrate on a granular but fundamental aspect of modularity principles -- modular relation (MR), i.e., whether a pair of entities are separated or collocated. The main assumption is that, if the actual MR of a pair violates its `apt MR', i.e., an MR agreed on by multiple modularization tools (as raters), it can be deemed likely a flawed architectural decision that necessitates further examination. To quantify and evaluate PairSmell, we conduct an empirical study on 20 C/C++ and Java projects, using 4 established modularization tools to identify two forms of PairSmell: inapt separated pairs InSep and inapt collocated pairs InCol. Our study on 260,003 instances reveals that their architectural impacts are substantial: (1) on average, 14.60% and 20.44% of software entities are involved in InSep and InCol MRs respectively; (2) InSep pairs are associated with 190% more co-changes than properly separated pairs, while InCol pairs are associated with 35% fewer co-changes than properly collocated pairs, both indicating a successful identification of modular structures detrimental to software quality; and (3) both forms of PairSmell persist across software evolution.

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

↑