首页 | 官方网站   微博 | 高级检索  
相似文献
 共查询到19条相似文献,搜索用时 125 毫秒
1.
一种基于依赖性分析的类内聚度度量方法   总被引:8,自引:2,他引:8  
陈振强  徐宝文 《软件学报》2003,14(11):1849-1856
内聚度是指模块内各成分之间的联结强度.在面向对象程序中,内聚度主要是指类内部各成分之间的联结强度.在深入剖析了类的属性与属性、方法与属性以及方法与方法之间的关系及其性质的基础上,提出了一种基于依赖性分析的内聚度度量方法,并证明了它满足优良的内聚度度量方法应该具有的性质,从而克服了已有方法只是分析了某个方面的不足,为综合评价类内聚度提供了指南。  相似文献   

2.
本文首先介绍了面向对象软件的特征,然后具体分析了C&K度量法,着重分析了其中与类继承相关的继承树深度(DIT)和孩子数目(NOC)度量准则。在此基础上,通过分析超类与其子类中元素(方法和属性)的继承关系,提出了基于继承的内聚度度量方法,从而克服了C&K度量法中对类继承性、多态性方面度量的不足,为综合评价类的内聚度度提供了指南。  相似文献   

3.
黄子杰  陈军华  高建华 《软件学报》2021,32(8):2505-2521
Code Smell是软件程序中存在不良设计和不良实现的征兆.正确地检测和识别Code Smell可以指导软件重构,提高软件的可用性和可靠性.通过Code Smell的度量指标,可以量化软件的设计问题.JavaScript已成为最常用的编程语言之一,类是JavaScript的设计模式,优秀类的设计体现为高内聚和低耦合.现有关于JavaScript内聚耦合的Code Smell研究均在微观的层面,即函数和语句上进行.它们可以提供程序实现的重构建议,但无法分析内聚耦合相关的软件系统设计问题.针对FE、DC和Blob这3种类的内聚耦合Code Smell,提出一种JavaScript类的内聚耦合Code Smell检测方法JS4C.该方法基于静态分析,同时适用于客户端和服务端程序.它通过遍历软件系统中所有的类,利用源程序的文本相似度特征和结构特征,识别Code Smell并检测其强度.在结构特征检测中,JS4C使用了经扩展的对象类型推断及非严格的耦合分散度度量法NSCDISP,有效地降低了解释型语言的静态分析过程中,类型信息缺失对检测产生的影响.实验通过对6个开源项目的分析表明,JS4C对内聚耦合设计问题有良好的检测效果.  相似文献   

4.
周晓聪  赖蔚  温剑丰 《软件学报》2018,29(10):3051-3067
度量数据的分布信息对于理解和使用面向对象软件度量有重要意义.人们对面向对象软件规模度量、耦合度度量乃至继承维度的度量数据的分布都有研究,但对除内聚度缺乏度LCOM之外的内聚度度量数据的分布却缺乏研究.已有的实证研究表明,LCOM并不是好的内聚度度量,因此探讨其他内聚度度量数据分布很有必要.对包括内聚度缺乏度、基于连通性的内聚度度量和基于相似性的内聚度度量总共17个度量指标在112个Java开源软件项目的分布情况进行实证研究,对每个度量指标的每个项目数据使用幂律分布和对数正态分布进行拟合,并使用荟萃分析方法对拟合结果进行了分析.实证研究结果表明,非规范化的内聚度量可使用对数正态分布和幂律分布拟合,但规范化的基于相似性的内聚度量(包括CC、LSCC、SCOM和SCC)需要排除方法数小于等于1或字段数为0的特殊类才能使用对数正态分布拟合,而基于连通性的内聚度度量(包括TCC、LCC、DCD和DCI)则只有对应的非规范化版本的数据才符合对数正态分布或幂律分布.实证研究可帮助人们更好地理解和使用内聚度度量,特别是可以帮助人们如何利用已有的方法确定内聚度度量的阈值.  相似文献   

5.
基于数据切片度量JAVA内聚性   总被引:1,自引:0,他引:1  
李必信  朱平  谭毅  李宣东  郑国梁 《软件学报》2001,12(12):1851-1858
面向对象的程序切片在程序分析、程序理解、软件测试和调试以及软件维护方面有着广泛的用途.首先建立了抽象数据切片和类内切片的概念,然后基于这两种切片讨论了JAVA语言中存在的内聚问题,通过分析这些切片与数据、方法、类之间的关系来度量数据、方法以及类的内聚性问题.  相似文献   

6.
聚类分析是数据挖掘中最重要的技术之一,它在社会经济的各个领域都具有重要作用,并被广泛应用。K均值算法是最经典、应用最广泛的聚类方法之一,但其缺点是过度依赖初始条件和聚类数目难以确定,这制约了其应用范围。引入簇的内聚度和耦合度的定义与度量方法,基于“高内聚低耦合”的原理,在二分K均值聚类过程中对得到的簇进行不断的分裂和合并,并判断聚类结果是否满足要求以确定聚类的次数和簇的个数,从而实现对二分K均值聚类过程的改进。在Iris数据集上的实验测试与分析表明该算法不仅更加稳定,而且其聚类结果的正确率也较高。  相似文献   

7.
距离与差异性度量是聚类分析中的基本概念,是许多聚类算法的核心内容。在经典的聚类分析中,度量差异性的指标是距离的简单函数。该文针对混合属性数据集,提出两种距离定义,将差异性度量推广成为距离、类大小等因素的多元函数,使得原来只适用于数值属性或分类属性数据的聚类算法可用于混合属性数据。实验结果表明新的距离定义和差异性度量方法可提高聚类的质量。  相似文献   

8.
模糊聚类分析主要研究样本的分类问题.本文利用模糊聚类方法对软件缺陷进行分类,引入缺陷数据属性权重计算方法,依据数据挖掘中的属性邻近性度量方法,对缺陷数据进行相似度分析.并按照属性类别进行分析,不仅体现了缺陷数据属性间的形贴近程度,而且体现了属性之间的距离贴近程度.本文方法对软件缺陷数据进行分析并对比度量结果,实验结果充分说明改进后的模糊聚类相似性度量方法在分类准确性方面有一定程度的提高.  相似文献   

9.
针对欧氏距离将个体的不同属性(即各指标或各变量)之间的差别等同看待,忽视了个体不同属性的重要性。考虑数据的几何结构特征和个体属性,结合马氏距离提出一种新的属性相似性度量方法及新的聚类有效性函数;对采用欧氏距离的分层聚类算法进行改进。改进的聚类算法能提高聚类的速度和质量,是一种有效的聚类方法。  相似文献   

10.
基于流数据的模糊聚类算法   总被引:1,自引:0,他引:1  
对流数据进行有效聚类是一个吸引研究者很大注意力的问题.传统的聚类挖掘算法只能适用于纯数值属性数据或纯分类属性数据,很难适用于混合属性的数据.针对混合属性数据的特点,在借鉴AcluStream算法的基础上,提出了一种模糊聚类算法.算法对流数据的相异度分类度量,定量属性使用欧氏距离和曼哈坦距离度量,定性属性可以采用hamming距离度量.模糊聚类算法的主要步骤有两步:第一步,运用最小距离聚类算法进行聚类,构成一个初始类.第二步,对基于最小距离聚类算法进行聚类所得到的初始簇,运用密度聚类方法进行聚合或分割,使得聚类集合稳定.实践证明:该算法是快速地有效的.  相似文献   

11.
Jehad Al Dallal 《Software》2013,43(6):685-704
Class cohesion metrics apply different approaches to quantify the relatedness of the attributes and methods in a class. These relations can be direct or transitive. Method invocations are among the key sources of potential transitive attribute–method relations. That is, a method is not only related to the attributes that it references, but it may also be transitively related to the attributes referenced by the methods that it invokes. A few of the existing class cohesion metrics capture this potential transitive cohesion aspect. In this paper, we classify the method invocations as direct or transitive. The definitions of the class representative models used by 16 existing low‐level design (LLD) metrics are extended to incorporate the cohesion caused by the two types of method invocations. The impact of incorporating the transitive relations because of the two types of method invocations on the cohesion values and on the ability of the LLD metrics to predict faulty classes are studied empirically. The results show that the transitive relations because of both types of method invocations featured a considerable degree of cohesion that is not captured by most of the existing LLD metrics. However, practically, incorporating transitive relations in cohesion measurement was found to be ineffective in improving the fault‐prediction powers of most of the LLD metrics. Copyright © 2012 John Wiley & Sons, Ltd.  相似文献   

12.
Measuring class cohesion based on dependence analysis   总被引:1,自引:0,他引:1       下载免费PDF全文
Classes are the basic modules in object-oriented (OO) software, which consist of attributes and methods. Thus, in OO environment, the cohesion is mainly about the tightness of the attributes and methods of classes. This paper discusses the relationships between attributes and attributes, attributes and methods,methods and methods of a class based on dependence analysis. Then the paper presents methods to compute these dependencies. Based on these, the paper proposes a method to measure the class cohesion, which satisfies the properties that a good measurement should have. The approach overcomes the limitations of previous class cohesion measures, which consider only one or two of the three relationships in a class.  相似文献   

13.
Improving the applicability of object-oriented class cohesion metrics   总被引:1,自引:0,他引:1  

Context

Class cohesion is an important object-oriented quality attribute. It refers to the degree of relatedness between the methods and attributes of a class. Several metrics have been proposed to measure the extent to which the class members are related. Most of these metrics have undefined values for a relatively high percentage of classes, which limits their applicability. The classes that have undefined values lack methods, attributes, or parameter types, or they include only a single method.

Objective

We improve the applicability of the class cohesion metrics by defining their values for such special classes. In addition, we theoretically and empirically validate the improved metrics.

Method

We theoretically examine whether the defined values satisfy the key cohesion properties. In addition, we empirically validate the metrics before and after the improvements to test whether the defined values improve the ability of the metrics to evaluate class cohesion. We also explore the correlation between the metrics and the presence of faulty classes to indirectly determine the strength or weakness of the metrics in indicating class quality.

Results

The results show that our assigned values for the undefined cases do not violate the key cohesion properties and considerably improve the ability of the metrics to explain the presence of faulty classes and may therefore improve their ability to indicate the quality of the class design.

Conclusions

Having the class cohesion metrics defined for all possible cases improves the applicability of the metrics and potentially increases their precision in indicating class quality.  相似文献   

14.
Baowen Xu  Yuming Zhou 《Software》2001,31(14):1381-1388
Although H. S. Chae's class cohesion measure considers not only the number of interactions, but also the patterns of the interactions among the constitute members of a class (which overcomes the limitations of previous class cohesion measures) it, however, only partly considers the patterns of interactions, and might cause the measuring results to be inconsistent with intuition in some cases. This paper discusses the demerits and proposes constructive amendments to Chae's cohesion measure. Copyright © 2001 John Wiley & Sons, Ltd.  相似文献   

15.
Cohesion is a design quality that has a great impact on the posterior development and maintenance. As software evolves, the cohesion of the system becomes weaker due to the changes introduced during evolution. Over evolution, a single responsibility class may be unintentionally assigned other responsibilities, which makes the class less cohesive and more complex and consequently increases the complexity of the entire system. There has been much work on decomposing class responsibilities based on internal class relationships such as method-attribute referencing and internal method calls. However, object-oriented systems involve significant external class relationships carrying important behavioral semantics, which should be taken into account in identifying class responsibilities. In this paper, we present a novel approach for identifying and decomposing classes responsibilities based on method similarity using both internal and external class relationships.We extend the existing work for measuring similarity of internal class relationships and present a distance-based method for measuring external class relationships. We evaluate the approach using three open source applications — JMeter, JHotDraw, and ArgoUML. The evaluation shows that the presented approach improves precision over the existing work. We validate the results using independent samples T-test and ANOVA applied to a set of hypotheses. The validation confirms that the results are statistically significant.  相似文献   

16.
The quality of internetware software is significantly associated with class structure.As software evolves,changes often introduce many unrelated responsibilities to the same classes or distribute tightly-related methods in different classes.These changes make the classes difficult to understand and maintain.Extract class refactoring is an effective technique to improve the quality of software structure by decomposing unrelated methods in one class to create new classes or extracting tightly-related methods from different classes.In this paper,we propose a novel approach for class extraction from internetware source codes.This approach leverages a community structure detection technique to partition software into clusters and extracts classes from the resulting clusters.Our experimental results,which investigate the public well-known internetware PKUAS,indicate that:(1)the proposed approach is much faster than existing search-based clustering approaches(Hillclimbing and Genetic algorithm)and is thus applicable for large-scale internetware;(2)the proposed approach can identify meaningful class extractions for internetware;and(3)Extract Class refactoring candidates identified by the proposed approach significantly improve class cohesion of internetware.  相似文献   

17.
Class cohesion is a key attribute that is used to assess the design quality of a class, and it refers to the extent to which the attributes and methods of the class are related. Typically, classes contain special types of methods, such as constructors, destructors, and access methods. Each of these special methods has its own characteristics, which can artificially affect the class cohesion measurement. Several metrics have been proposed in the literature to indicate class cohesion during high- or low-level design phases. The impact of accounting for special methods in cohesion measurement has not been addressed for most of these metrics. This paper empirically explores the impact of including or excluding special methods on cohesion measurements that were performed using 20 existing class cohesion metrics. The empirical study applies the metrics that were considered to five open-source systems under four different scenarios, including (1) considering all special methods, (2) ignoring only constructors, (3) ignoring only access methods, and (4) ignoring all special methods. This study empirically explores the impact of including special methods in cohesion measurement for two applications of interest to software practitioners, including refactoring and predicting faulty classes. The results of the empirical studies show that the cohesion values for most of the metrics considered differ significantly across the four scenarios and that this difference significantly affects the refactoring decisions, but does not significantly affect the abilities of the metrics to predict faulty classes.  相似文献   

18.
In object-oriented systems, a single class consists of attributes and methods and its cohesion denotes the degree of relatedness among these elements. To quantify the cohesiveness of a class, a large number of measures that only depict method–attribute reference relationships have been proposed in last decade. However, the flow-dependence relationships among attributes, the direction of method–attribute references, and the potential dependence relationships among the elements in the class are ignored. To address this problem, this paper first depicts four types of explicit dependence relationships and uses a class element dependence graph to represent all dependencies among the elements in a class. Then, a dependence matrix that reflects the degree of direct dependence and indirect dependence among the elements in a class is computed. Finally, a more precise cohesion measure for classes is proposed.  相似文献   

19.
在机器学习和数据挖掘实际应用中,针对分类训练集的选取,通常要求训练集中每一类所包含的数据在数量上要尽可能的"均衡".本文以非均衡训练集与分类学习效率关系研究为依据,给出了"均匀度"和"内聚度"两种类型的训练集非均衡程度因素的概念;"均匀度"是用来描述训练集类之间(between-class)的非均衡程度,其含义是指训练集不同类之间数据数量的非均衡程度;"内聚度"是用来描述训练集类内部(within-class)的非均衡程度,指训练集中不同类在空间分布上的线性相关程度,通过训练集数据之间的相关程度,构建出训练集的网络结构,运用一种能体现训练集内聚性的网络拓扑结构的指标-网络社区结构作为度量,提出了基于网络社区模块结构的非均衡训练集度量方法,并指出了高均匀度和高内聚度是选取"优良"分类训练集的关键因素.通过对UCI标准训练集的实验,结果验证本方法作为选取训练集标准的有效性.  相似文献   

设为首页 | 免责声明 | 关于勤云 | 加入收藏

Copyright©北京勤云科技发展有限公司    京ICP备09084417号-23

京公网安备 11010802026262号