Improving Class Cohesion Measurement: Towards a Novel Approach Using Hierarchical Clustering


Class cohesion is considered as one of the most important object-oriented software attributes. High cohesion is, in fact, a desirable property of software. Many different metrics have been suggested in the last several years to measure the cohesion of classes in object-oriented systems. The class of structural object-oriented cohesion metrics is the most in-vestigated category of cohesion metrics. These metrics measure cohesion on structural information extracted from the source code. Empirical studies noted that these metrics fail in many situations to properly reflect cohesion of classes. This paper aims at exploring the use of hierarchical clustering techniques to improve the measurement of cohesion of classes in object-oriented systems. The proposed approach has been evaluated using three particular case studies. We also used in our study three well-known structural cohesion metrics. The achieved results show that the new approach appears to better reflect the cohesion (and structure) of classes than traditional structural cohesion metrics.

Share and Cite:

L. Sadaoui, M. Badri and L. Badri, "Improving Class Cohesion Measurement: Towards a Novel Approach Using Hierarchical Clustering," Journal of Software Engineering and Applications, Vol. 5 No. 7, 2012, pp. 449-458. doi: 10.4236/jsea.2012.57051.

Conflicts of Interest

The authors declare no conflicts of interest.


[1] L. H. Etzkorn, S. E. Gholston, J. L. Fortune, C. E. Stein, D. Utley, P. A. Farrington and G. W. Cox, “A Comparison of Cohesion Metrics for Object-Oriented Systems,” Information and Software Technology, Vol. 46, No. 10, 2004, pp. 677-687. doi:10.1016/j.infsof.2003.12.002
[2] H. Aman, K. Yamasaki, H. Yamada and M. T. Noda, “A Proposal of Class Cohesion Metrics Using Sizes of Cohesive Parts,” In: T. Welzer, et al., Eds., Knowledge-Based Software Engineering, IOS Press, Amsterdam, 2002, pp. 102-107.
[3] H. S. Chae, Y. R. Kwon and D. H. Bae, “Improving Cohesion Metrics for Classes by Considering Dependent Instance Variables,” IEEE Transactions on Software Engineering, Vol. 30, No. 11, 2004, pp. 826-832. doi:10.1109/TSE.2004.88
[4] H. Kabaili, R. K. Keller and F. Lustman, “Cohesion as Changeability Indicator in Object-Oriented Systems,” Proceedings of the 5th European Conference on Software Maintenance and Reengineering, Lisbon, 14-16 March 2001. doi:10.1109/CSMR.2001.914966
[5] A. Marcus and D. Poshyvanyk, “The Conceptual Cohesion of Classes,” Proceedings of the 21st International Conference on Software Maintenance, Budapest, 25-30 September 2005, pp. 133-142.
[6] L. Badri, M. Badri and G. A. Badara, “Revisiting Class Cohesion: An Empirical Investigation on Several Systems,” Journal of Object Technology, Vol. 7, No. 6, 2008, pp. 55-75. doi:10.5381/jot.2008.7.6.a1
[7] Z. Chen, Y. Zhou, B. Xu, J. Zhao and H. Yang, “A Novel Approach to Measuring Class Cohesion Based on Dependence Analysis,” Proceedings of the 18th International Conference on Software Maintenance, Timisoara, 12-18 September 2002.
[8] S. Counsell and S. Swift, “The Interpretation and Utility of Three Cohesion Metrics for Object-Oriented Design,” ACM Transactions on Software Engineering and Methodology, Vol. 15, No. 2, 2006, pp. 123-149. doi:10.1145/1131421.1131422
[9] A. De Lucia, R. Oliveto and L. Vorraro, “Using Structural and Semantic Metrics to Improve Class Cohesion,” Proceedings of the International Conference on Software Maintenance, Beijing, 28 September-4 October 2008.
[10] A. Marcus, D. Poshyvanyk and R. Ferenc, “Using the Conceptual Cohesion of Classes for Fault Prediction in Object-Oriented Systems,” IEEE Transactions on Software Engineering, Vol. 34, No. 2, 2008, pp. 287-300.
[11] T. M. Meyers and D. Binkley, “Slice-Based Cohesion Metrics and Software Intervention,” Proceedings of the 11th Working Conference on Reverse Engineering, Delft, 8-12 November 2004, pp. 256-265. doi:10.1109/WCRE.2004.34
[12] G. Woo, H. S. Chae, J. F. Cui and J. H. Ji, “Revising Cohesion Measures by Considering the Impact of Write Interactions between Class Members,” Information and Software Technology, Vol. 51, No. 2, 2009, pp. 405-417.
[13] Y. Zhou, B. Xu, J. Zhao and H. Yang, “ICBMC: An Improved Cohesion Measure for Classes,” Proceedings of the International Conference on Software Maintenance, Montréal, 3-6 October 2002.
[14] Y. Zhou, L. Wen, J. Wang, Y. Chen, H. Lu and B. Xu, “DRC: Dependence-Relationships-Based Cohesion Measure for Classes,” Proceedings of the 10th APSEC, Chiang Mai, 10-12 December 2003.
[15] T. A. Wiggerts, “Using Clustering Algorithms in Legacy Systems Remodularization,” Proceedings of the 4th Working Conference on Reverse Engineering, Washington, 6-8 October 1997. doi:10.1109/WCRE.1997.624574
[16] I. G. Czibula, G. Czibula and G. S. Cojocar, “Hierarchical Clustering for Identifying Crosscutting Concerns in Object-Oriented Software Systems,” Proceedings of the 4th Balkan Conference in Informatics, Thessaloniki, 17-19 September 2009.
[17] J. Han and M. Kamber, “Data Mining: Concepts and Techniques,” Morgan Kaufmann Publishers, Waltham, 2001.
[18] G. S. Moldovan and G. Serban, “Aspect Mining Using a Vector Space Model Based Clustering Approach,” Proceedings of Linking Aspect Technology and Evolution Workshop, Bonn, 20 March 2006, pp. 36-40.
[19] N. Anquetil, C. Fourrier and T. Lethbridge, “Experiments with Hierarchical Clustering Algorithms as Software Remodularization Methods,” Proceedings of the Working Conference on Reverse Engineering, Benevento, 23-27 October 1999.
[20] C.-H. Lung, “Software Architecture Recovery and Restructuring through Clustering Techniques,” Proceedings of the 3rd International Software Architecture Workshop, Orlando, 1-5 November 1998, pp. 101-104.
[21] I. G. Czibula and G. Czibula, “A Partitional Clustering Algorithm for Improving the Structure of Object-Oriented Software Systems,” Studia Universitatis Babes-Bolyai, Series Informatica, Vol. 3, No. 2, 2008.
[22] C. Lung, M. Zaman and A. Nandi, “Applications of Clustering Techniques to Software Partitioning, Recovery and Restructuring,” Journal of Systems and Software, Vol. 73, No. 2, 2004, pp. 227-244. doi:10.1016/S0164-1212(03)00234-6
[23] C.-H. Lung and M. Zaman, “Using Clustering Technique to Restructure Programs,” Proceedings of the International Conference on Software Engineering Research and Practice, Las Vegas, 21-24 June 2004, pp. 853-860.
[24] G. Serban and I. G. Czibula, “Restructuring Software Systems Using Clustering,” Proceedings of the 22nd International Symposium on Computer and Information Sciences, Ankara, 7-9 November 2007. doi:10.1109/ISCIS.2007.4456872
[25] G. Snelting, “Software Reengineering Based on Concept Analysis,” Proceedings of the European Conference on Software Maintenance and Reengineering, Zurich, 29 February-3 March 2000, pp. 1-8.
[26] G. S. Cojocar, G. Czibula and I. G. Czibula, “A Comparative Analysis of Clustering Algorithms in Aspect Mining,” Studia Universitatis Babes-Bolyai, Series Informatica, Vol. 4, No. 1, 2009.
[27] L. He and H. Bai, “Aspect Mining Using Clustering and Association Rule Method,” International Journal of Computer Science and Network Security, Vol. 6, No. 2A, 2006, pp. 247-251.
[28] G. Serban and G. S. Moldovan, “A New k-Means Based Clustering Algorithm in Aspect Mining,” Proceedings of 8th International Symposium on Symbolic and Numeric Algorithms for Scientific Computing, Timisoara, 26-29 September 2006, pp. 69-74. doi:10.1109/SYNASC.2006.5
[29] D. Shepherd and L. Pollock, “Interfaces, Aspects, and Views,” Proceedings of Linking Aspect Technology and Evolution Workshop, Chicago, 15 March 2005.
[30] D. Zhang, Y. Guo and X. Chen, “Automated Aspect Recommendation through Clustering-Based Fan-In Analysis,” Proceedings of the 23rd IEEE/ACM International Conference on Automated Software Engineering, l’Aquila, 15-19 September 2008, pp. 278-287.
[31] S. R. Chidamber and C. F. Kemerer, “A Metrics Suite for Object Oriented Design,” IEEE Transactions on Software Engineering, Vol. 20, No. 6, 1994, pp. 476-493. doi:10.1109/32.295895
[32] B. Henderson-Sellers, “Software Metrics,” Prentice Hall, Upper Saddle River, 1996.
[33] J. M. Bieman and B. K. Kang, “Cohesion and Reuse in an Object-Oriented System,” Proceedings of the Symposium on Software Reusability, Seattle, 23-30 April 1995, pp. 259-262. doi:10.1145/211782.211856
[34] L. C. Briand, J. Daly and J. Wusr, “A Unified Framework for Cohesion Measurement in Object-Oriented Systems,” Empirical Software Engineering, Vol. 3, No. 1, 1998, pp. 67-117. doi:10.1023/A:1009783721306
[35] M. Hitz and B. Montazeri, “Measuring Coupling and Cohesion in Object-Oriented Systems,” Proceeding of the International Symposium on applied Corporate Computing, Monterrey, 25-27 October 1995, pp. 25-27.
[36] W. Li and S. Henry, “Object-Oriented Metrics That Predict Maintainability,” Journal of Systems and Software, Vol. 23, No. 2, 1993, pp. 111-122. doi:10.1016/0164-1212(93)90077-B
[37] L. Etzkorn and H. Delugach, “Towards a Semantic Metrics Suite for Object-Oriented Design,” Proceedings of the 34th International Conference on Technology of Object-Oriented Languages and Systems, Xi’an, 30 October- 4 November 2000, pp. 7-80.
[38] E. B. Allen, T. M. Khoshgoftaar and Y. Chen, “Measuring Coupling and Cohesion of Software Modules: An Information-Theory Approach,” Proceedings of 7th International Software Metrics Symposium, London, 4-6 April 2001, pp. 124-134.
[39] C. Montes de Oca and D. L. Carver, “Identification of Data Cohesive Subsystems Using Data Mining Techniques,” Proceedings of International Conference on Software Maintenance, Bethesda, 16-19 November 1998, pp. 16-23.
[40] E. S. Cho, C. J. Kim, D. D. Kim and S. Y. Rhew, “Static and Dynamic Metrics for Effective Object Clustering,” Proceedings of Asia Pacific International Conference on Software Engineering, IEEE Computer Society, Washington, 1998, pp. 78-85.
[41] L. Badri and M. Badri, “A Proposal of a New Class Cohesion Criterion: An Empirical Study,” Journal of Object Technology, Vol. 3, No. 4, 2004, pp. 145-159. doi:10.5381/jot.2004.3.4.a8
[42] H. S. Chae, Y. R. Kwon and D. H. Bae, “A Cohesion Measure for Object-Oriented Classes,” Software Practice and Experience, Vol. 30, No. 12, 2000, pp. 1405-1431. doi:10.1002/1097-024X(200010)30:12<1405::AID-SPE330>3.0.CO;2-3
[43] F. Simon, S. L?ffler and C. Lewerentz, “Distance Based Cohesion Measuring,” Proceedings of the 2nd European Software Measurement Conference, Amsterdam, 4-8 October 1999.
[44] M. Bunge, “Ontology I: The Furniture of the World,” Treatise on Basic Philosophy, Vol. 3, D. Reidel Publishing Company, Dordrecht, 1977.
[45] J. Hartigan, “Clustering Algorithms,” Wiley, New York, 1975.
[46] W. J. Krzanowski and Y. T. Lai, “A Criterion for Determining the Number of Groups in a Data Set Using Sum of Squares Clustering,” Biometrics, Vol. 44, 1988, pp. 23-34. doi:10.2307/2531893
[47] L. Kaufman and P. J. Rousseuw, “Finding Groups in Data: An Introduction to Cluster Analysis,” Wiley-Interscience, New York, 1990. doi:10.1002/9780470316801
[48] R. Tibshirani, G. Walther and T. Hastie, “Estimating the Number of Data Clusters via the Gap Statistic,” Journal of the Royal Statistical Society B, Vol. 63, No. 2, 2001, pp. 411-423.
[49] S. Dudoit and J. Fridlyand, “A Prediction-Based Resampling Method for Estimating the Number of Clusters in a Dataset,” Genome Biology, Vol. 3, No. 7, 2002, Research 0036.1-0036.21.
[50] J. Cooper, “Java Design Patterns: A Tutorial,” Addison-Wesley, New York, 2000.
[51] J. Hannemann and G. Kiczales, “Design Pattern Implementation in Java and AspectJ,” Proceedings of the 17th Annual Conference on Object-oriented Programming Systems, Languages and Applications, Seattle, 4-8 November 2002, pp. 161-173.
[52] M. J. T. Monteiro, “Refactorings to Evolve Object-Oriented Systems with Aspect-Oriented Concepts,” Ph.D. Thesis, Universidade do Minho, Minho, 2005.
[53] E. Gamma, et al., “Design Patterns—Elements of Reusable Object-Oriented Software,” Addison-Wesley, New York, 1994
[54] St. Hanenberg and R. Unland, “A Proposal for Classifying Tangled Code,” 2nd AOSD-GI Workshop, Bonn, 21-22 February 2002.

Copyright © 2024 by authors and Scientific Research Publishing Inc.

Creative Commons License

This work and the related PDF file are licensed under a Creative Commons Attribution 4.0 International License.