Abstract

Intuitively, in a certain class, a pair of methods that share an attribute of an object type is potentially more cohesive than those that share an attribute of a primitive type because the attribute of a reference type could implicitly refer to multiple data. Existing class cohesion measures ignore the implicit access to or sharing of attributes due to the encapsulation feature. As a result, the obtained cohesion values can be inaccurate and could lead to incorrect quality indications. This paper aims at demonstrating how to account for data encapsulation DE in cohesion measurement and reports empirical studies that investigate the impact of considering DE in cohesion measurement on cohesion values and the abilities of cohesion measures to predict class fault proneness. To differentiate between attributes and parameters of different types, we propose a weight assignment algorithm. The weight that is assigned to an attribute or a parameter of a type depends on the number of encapsulated attributes of the type. Seven cohesion measures are extended to consider the assigned weights in cohesion measurement. The results of the empirical study show that the cohesion values and the corresponding fault-proneness prediction results can significantly change when accounting for DE in cohesion measurement. Copyright © 2015 John Wiley & Sons, Ltd.

Full Text
Published version (Free)

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call