Premium
Accounting for data encapsulation in the measurement of object‐oriented class cohesion
Author(s) -
Al Dallal Jehad
Publication year - 2015
Publication title -
journal of software: evolution and process
Language(s) - English
Resource type - Journals
SCImago Journal Rank - 0.371
H-Index - 29
eISSN - 2047-7481
pISSN - 2047-7473
DOI - 10.1002/smr.1714
Subject(s) - cohesion (chemistry) , computer science , empirical research , artificial intelligence , mathematics , statistics , chemistry , organic chemistry
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.