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

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

来源:网络收集 时间:2026-05-21
导读: Weak Functional Cohesion, WFC, is de ned as the ratio of glue tokens to the total number of data tokens in a procedure, p, tokens(p). It indicates a\weaker type of cohesion than indicated by super-gl

Weak Functional Cohesion, WFC, is de ned as the ratio of glue tokens to the total number of data tokens in a procedure, p, tokens(p). It indicates a\weaker" type of cohesion than indicated by super-glue tokens as adding a glue token can\glue" together previously non-cohesive elements even if the token does not glue together all of the slices.p)) WFC (p)= jjG(SA((p)jj tokens

Adhesiveness, A, is de ned to be the ratio of the sum of all the slices containing gluetokens to the product of the total number of tokens and the number of data slices.

A(p)=

P

t G(SA(p))# slices containing t

jtokens(p)j jSA(p)j

3.6.1 Class SlicingWe used modi cations of the slice-based functional cohesion measures de ned by Bieman and Ott 9] in the procedural paradigm, to de ne the slice-based data cohesion measures in the object-oriented paradigm. We used the concept of data tokens, glue and super-glue tokens to de ne the metric data slices for a class and the data cohesion measures. The slice data tokens in the object-oriented paradigm were de ned to be the data tokens de ned in the private or the protected sections in the class. We considered these data tokens to be the slice data tokens as all the operations de ned in a class are performed on these data tokens. In the case of the object-oriented paradigm, a class including all the methods of the class is the basic unit considered to be a module. A metric data slice for each method of the class is obtained using the same de nitions of\forward" and\backward" slices as de ned for the procedural paradigm 9]. The slices thus obtained for each method are then combined to obtain the metric data slice for a class. Thus, a metric data slice for a class is the concatenation of the metric data slices for each of the methods of the class. The rede ned measures will then be applied to the class as a module. 12

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

Modifying the de nitions found in 9], we de ne the class slice abstraction of a class C with n methods, CSA(C ) to be the concatenation of all the slice abstractions of its methods denoted as MSA(mn) assuming MSA(mi) is the method slice abstraction of method mi of class C. The slice abstraction for class C is de ned as: CSA(C)= f MSA(m1 ), MSA(m2 ), . . ., MSA(mn )g

3.6.2 Data Cohesion MeasuresThe data cohesion measures are described in terms of slice abstractions, data tokens, and glue and super-glue tokens 9] but as applied to the object-oriented paradigm. The basic de nition for a data token and glue and super-glue to

kens remained similar to their de nition in the procedural paradigm. The set of super-glue tokens for the class, C, denoted as, SG(CSA(C)), was de ned to be a union of the super-glue tokens of each of the methods of the class. Similarly, the set of glue tokens for the class, C, denoted as G(CSA(C)), was de ned to be the union of the glue tokens of each of the methods of the class. tokens(C) is a set of all data tokens of a class C. Strong data cohesion, SDC, is a measure based on the number of data tokens included in all the data slices for a class, i.e., a count of the number of super-glue tokens in the class C . The super-glue tokens bind all the data slices together and are indicative of a highly cohesive class. Thus, a class where all data tokens are super-glue tokens will have data cohesion of 1 while a class with no super-glue tokens will have no cohesion. Classes with fewer number of super-glue tokens will have lower strong data cohesion than classes where all data tokens are super-glue. (C SDC (C )= jSG(CSAC )j))j jtokens(

Weak data cohesion, WDC, is indicative of the amount of cohesion in a class based onthe number of glue tokens. Glue tokens, unlike the super-glue tokens, do not necessarily bind all the data slices together, hence are indicative of a weaker type of cohesion. A class with no glue tokens will have no cohesion. This type of cohesion is more sensitive than strong data cohesion which is based on super-glue tokens. Adding a glue token may bind together previously non-cohesive elements even if it does not bind together all the slices. (C )) WDC (C )= jG(CSA(C )j j jtokens

Adhesiveness, A, is a measure of the cohesiveness of a class, i.e. the binding or relatedness

among the data slices. It is a comparison between the glue tokens and the total number of data tokens in a class. Adhesiveness for a class C can be de ned as the ratio of the sum of all the slices containing glue tokens to the product of the number of data tokens in the class and the number of data slices. Thus,

A(C )=

P

d G(CSA(C ))# slices containing d

jtokens(C )j jCSA(C )j13

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

Weak data cohesion and Adhesiveness di er from Strong data cohesion in cases of three or more data slices. In the case of 1 or 2 data slices, SDC(C)=WDC(C)=A(C). The values of the measures always lies between 0 and 1, where 0 indicates no cohesion and 1 indicates high cohesion.

14

…… 此处隐藏:3320字,全部文档内容请下载后查看。喜欢就下载吧 ……
A critique of cohesion measures in the object-oriented parad(5).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)