This paper suggests that a single class rather than methods should be used as the slice scope to compute class cohesion. First, for a given attribute, the statements in all methods that last define the attribute are c...This paper suggests that a single class rather than methods should be used as the slice scope to compute class cohesion. First, for a given attribute, the statements in all methods that last define the attribute are computed. Then, the forward and backward data slices for this attribute are generated by using the class as the slice scope and are combined to compute the corresponding class data slice. Finally, the class cohesion is computed based on all class data slices for the attributes. Compared to traditional cohesion metrics that use methods as the slice scope, the proposed metrics that use a single class as slice scope take into account the possible interactions between the methods. The experimental results show that class cohesion can be more accurately measured when using the class as the slice scope.展开更多
基金The National Natural Science Foundation of China(No.60425206,60633010)the High Technology Research and Development Program of Jiangsu Province(No.BG2005032)
文摘This paper suggests that a single class rather than methods should be used as the slice scope to compute class cohesion. First, for a given attribute, the statements in all methods that last define the attribute are computed. Then, the forward and backward data slices for this attribute are generated by using the class as the slice scope and are combined to compute the corresponding class data slice. Finally, the class cohesion is computed based on all class data slices for the attributes. Compared to traditional cohesion metrics that use methods as the slice scope, the proposed metrics that use a single class as slice scope take into account the possible interactions between the methods. The experimental results show that class cohesion can be more accurately measured when using the class as the slice scope.