教学文库网 - 权威文档分享云平台
您的当前位置:首页 > 文库大全 > 教育文库 >

A critique of cohesion measures in the object-oriented parad(4)

来源:网络收集 时间:2026-05-21
导读: 3.4 A Composite Cohesion MeasureBaxter, Chu and Patel 4], propose a composite cohesion measure to measure the cohesion in Ada packages. They claim that their cohesion measure is based on measuring th

3.4 A Composite Cohesion MeasureBaxter, Chu and Patel 4], propose a composite cohesion measure to measure the cohesion in Ada packages. They claim that their cohesion measure is based on measuring the cohesive strength of a module consisting of two or more primitive components (e.g. an Ada package consisting of subprograms such as procedures, functions, and tasks) 4]. Baxter, Chu and Patel claim that programs from the same package will use the same type of variables and hence have higher cohesion than programs from completely di erent packages. The following de nition is taken directly from 4]. Given a composite module P= fp1,p2, ..., pm g (where pi may either be a procedure or a function), the cohesion of a composite module is de ned as:

Cohesion(P )=

P

S Sim2(pi; pj ) Pm?1 i i

9

Cohesion refers to the "relatedness " of a module's components. In the object-oriented paradigm, cohesion refers to the "relatedness " among the methods of a class. Most of the current measures of cohesion in the object-oriented paradig

where S= f(i,j) j i,j 2 (1,m)^ i> jg Sim2(pi; pj ) is the summation of the similarity betw

een distinct pairs of functions or procedures in the module; the i>j condition insures that the similarity computation between a pair is only considered once within the summation.

Sim2(pi; pj )= qPn1

P

x2 i

pj S piq

P

n y2 1 i

where n is the number of members in the module. The numerator represents the summation of the product of the frequencies of the set of variables shared between modules pi and pj . This is explained in detail in the later part of this section. The denominator is the cardinality of modules pi and pj . Pm?1 i i computes the the total number of possible pairs for which the similarity metric is computed in the numerator. The composite module cohesion is thus computed to be the average of the similarity measures over distinct pairs of functions and procedures in the module 4]. Baxter, Chu and Patel claim that their proposed composite cohesion measure is based on information retrieval principles that accomplish the task of highlighting properties shared between members of a module. They claim that in the domain of information retrieval a logical organization of related members in a group is determined by a measure of similarity. A similarity measure is de ned so that an object is more like other objects in the same group and less like objects from other groups 30]. In order to compute the similarity between members of a module, rst a type vector for each member of the module must be computed. The basic idea is to scan the module for references to variables of a given type. If a member references a variable, V, and V is of type, T, then the counter associated with type T is incremented. Thus a type vector contains the frequency of the variables referenced of a particular type. The type vectors of all members are placed in a table where the rows represent the type vectors and the columns represent the members of the module. Once this is done, the similarity between the members is computed as Sim2(pi; pj ) where pi; pj are members of the module. The cohesion of the module, Cohesion(P), is de ned to be a ratio of the similarities between modules to the possible number of pairs for which the similarities can be computed. Baxter, Chu and Patel have obtained measurements for some Ada and C packages 4].

3.5 Bieman and Kang's Class Cohesion MeasuresBieman and Kang 6] propose two class cohesion measures to evaluate the relationship between class cohesion and private reuse in the system. They de ne class cohesion to be an attribute of a class that refers to the\relatedness" or\connectivity" among components of the class. The components include the instance variables and the methods de ned in a class plus those that are inherited. A method is said to be\related" or\connected" to an instance variable if the method uses that instance variable. 10

Cohesion refers to the "relatedness " of a module's components. In the object-oriented paradigm, cohesion refers to the "relatedness " among the methods of a class. Most of the current measures of cohesion in the object-oriented paradig

The class cohesion measures proposed by Bieman and Kang 6] are based on the direct or indirect connectivity between a pair of methods. Two methods that use one or more common instanc

e variables are said to be directly connected. Two methods that are connected through other directly connected methods, are indirectly connected. Let NDC(C), be the number of directly connected methods in a class C. NIC(C), is the number of indirectly connected methods in a class C. NP(C)=N * (N - 1)/2 is the maximum possible number of connections in a class. Tight class cohesion (TCC) is de ned to be a ratio of the number of directly connected methods in a class, NDC(C), to the maximum possible number of connections in a class. TCC(C)= NDC(C)/ NP(C) Loose class cohesion (LCC) is de ned to be a ratio of all directly connected methods, NDC(C), and indirectly connected methods, NIC(C), in a class to the maximum possible number of connections in a class, NP(C). LCC(C)= (NDC(C)+ NIC(C))/ NP(C)

3.6 Slice-Based Data Cohesion MeasuresHere we propose measures based on the slice-based functional cohesion measures in the procedural paradigm. By modifying the functional cohesion measures we de ne slice-based data cohesion measures for the object-oriented paradigm. In 9] Bieman and Ott introduce the concept of data slices to measure slice-based functional cohesion in the procedural paradigm. In order for the metrics to be sensitive to changes in code, they use data tokens (i.e., variable and constant de nitions and references) to measure cohesion. A data slice for a slice data token, v, is de ned to be the sequence of all data tokens Ti in the stat …… 此处隐藏:6029字,全部文档内容请下载后查看。喜欢就下载吧 ……

A critique of cohesion measures in the object-oriented parad(4).doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
本文链接:https://www.jiaowen.net/wenku/108005.html(转载请注明文章来源)
Copyright © 2020-2025 教文网 版权所有
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ:78024566 邮箱:78024566@qq.com
苏ICP备19068818号-2
Top
× 游客快捷下载通道(下载后可以自由复制和排版)
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
注:下载文档有可能出现无法下载或内容有问题,请联系客服协助您处理。
× 常见问题(客服时间:周一到周五 9:30-18:00)