为了改善Java源程序的质量,使之尽可能地符合“高内聚、低耦合”的设计要求,提出了扩展的Jaccard系数,并将其作为实体间相似性的度量公式,采用层次聚类算法将Java类图划分为若干个候选包。在基于交互及度量重构策略的引导下,对Java程序结构进行调整。通过实验表明,经过调整以后的Java源程序,在结构上更符合“高内聚、低耦合”的特征。
In order to improve the quality of the Java source code for meeting the design requirements of the“high cohe-sion, low coupling”, this paper presents an extended Jaccard index(also called Jaccard distance), based on which it imple-ments 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.