计算机工程与应用 ›› 2015, Vol. 51 ›› Issue (20): 50-54.

• 理论研究、研发设计 • 上一篇    下一篇

一种改进的基于层次聚类的软件重构技术研究

钟林辉,张能伟,侯长源,宗鸿雁   

  1. 江西师范大学 计算机信息与工程学院,南昌 330022
  • 出版日期:2015-10-15 发布日期:2015-10-30

Improved software refactoring method based on hierarchical clustering algorithm

ZHONG Linhui, ZHANG Nengwei, HOU Changyuan, ZONG Hongyan   

  1. School of Computer Information and Engineering, Jiangxi Normal University, Nanchang 330022, China
  • Online:2015-10-15 Published:2015-10-30

摘要: 为了改善Java源程序的质量,使之尽可能地符合“高内聚、低耦合”的设计要求,提出了扩展的Jaccard系数,并将其作为实体间相似性的度量公式,采用层次聚类算法将Java类图划分为若干个候选包。在基于交互及度量重构策略的引导下,对Java程序结构进行调整。通过实验表明,经过调整以后的Java源程序,在结构上更符合“高内聚、低耦合”的特征。

关键词: 软件重构, 高内聚, 低耦合, Jaccard系数

Abstract: In order to improve the quality of the Java source code for meeting the design requirements of the “high cohesion, low coupling”, this paper presents an extended Jaccard index (also called Jaccard distance), based on which it implements a hierarchical clustering algorithm to cluster several closely related classes into the candidate package. The tests show that the structure of Java source code is the more in line with the characteristics of high cohesion and low coupling after adjustment.

Key words: software refactoring, high cohesion, low coupling, Jaccard index