基于演化和语义特征的上帝类检测方法  

Approach of God Class Detection Based on Evolutionary and Semantic Features

在线阅读下载全文

作  者:王继文 吴毅坚[1,2] 彭鑫 WANG Ji-wen;WU Yi-jian;PENG Xin(Software School,Fudan University,Shanghai 200438,China;Shanghai Key Laboratory of Data Science,Shanghai 200438,China)

机构地区:[1]复旦大学软件学院,上海200438 [2]上海市数据科学重点实验室,上海200438

出  处:《计算机科学》2021年第12期59-66,共8页Computer Science

基  金:国家重点研发计划(2017YFB1002000);上海市科技发展基金项目(18DZ1112100,18DZ1112102)。

摘  要:随着软件开发迭代速度的加快,开发人员在编码过程中往往由于交付压力等种种原因违反软件设计的基本原则,造成代码坏味,进而影响软件质量。上帝类是最常见的代码坏味之一,指承担了太多职责的类。上帝类违反"高内聚、低耦合"的设计原则,损害软件系统的质量,会影响代码的可理解性和可维护性。因此,文中提出一种新的上帝类检测方法。首先抽取实际项目中方法在演化、语义等维度上的特征;然后对演化、语义特征进行融合,并基于融合后的结果重新聚类,将彼此关系紧密的方法重新划归到新的类簇中;通过分析实际项目中各个类的成员方法在新的聚类结果中的分布情况,计算类的内聚度,从而找出内聚度低的类作为上帝类检测结果。实验表明,所提方法优于目前主流的上帝类检测方法。与基于度量的传统检测方法相比,该方法在查全率、查准率上均提升超过20个百分点;与基于机器学习的检测方法相比,该方法尽管查全率略低,但查准率、F1值均有显著提升。With the acceleration of software development iterations, developers often violate the basic principles of software design due to various reasons such as delivery pressure, resulting in code smells and affecting software quality.God class is one of the most common code smells, referring to classes that have taken on too many responsibilities.God class violates the design principle of “high cohesion and low coupling”,damages the quality of the software system, and affects the understandability and maintainability of the code.Therefore, a new method of god class detection is proposed.It extracts the evolutionary and semantic features of the actual project, then merges the evolution and semantic features.Based on the merged features, it re-clusters all the methods for the projects.By analyzing the distribution of the member methods of each class in the actual project in the new clustering result, it calculates the cohesion of the class, and finds the class with low cohesion as the God class detection result.Experiments show that this method is superior to the current mainstream God class detection methods.Compared with traditional mea-surement-based detection methods, the recall and precision rates of the proposed method are increased by more than 20%.Compared with detection methods based on machine learning, although the recall rate of the proposed method is slightly lower, but the precision rate and F1 value are significantly improved.

关 键 词:上帝类 代码坏味 软件演化 内聚度 

分 类 号:TP311.5[自动化与计算机技术—计算机软件与理论]

 

参考文献:

正在载入数据...

 

二级参考文献:

正在载入数据...

 

耦合文献:

正在载入数据...

 

引证文献:

正在载入数据...

 

二级引证文献:

正在载入数据...

 

同被引文献:

正在载入数据...

 

相关期刊文献:

正在载入数据...

相关的主题
相关的作者对象
相关的机构对象