Open Access

Package level cohesion measurement in object-oriented software

Journal of the Brazilian Computer Society201118:52

https://doi.org/10.1007/s13173-011-0052-4

Received: 25 December 2010

Accepted: 6 December 2011

Published: 22 December 2011

Abstract

Packages are re-usable components for most of object-oriented systems. To promote reuse in object-oriented systems and to make deployment and maintenance tasks easy, packages in object-oriented systems must be cohesive. Quantification of cohesion of packages can be very useful in assessing their reusability, quality etc. In this paper, a new measure for the measurement of package cohesion is proposed. The cohesion of a package is measured in terms of the degree of intra-package dependencies among its elements. The hierarchical structure of packages has also been taken into account during the measurement. The proposed measure has been validated theoretically as well as empirically. An empirical study has been conducted using 25 packages taken from six open-source software projects developed in Java. The proposed package cohesion measure is found to be a useful indicator of external quality factors such as the reusability of packages. The proposed metric is also established as a better predictor of code reusability than the existing cohesion measures.

Keywords

CohesionMetricsQualityReusabilityPackagesObject-oriented software