Skip to main content
  • Original Paper
  • Open access
  • Published:

Package level cohesion measurement in object-oriented software

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.

References

  1. Allen E, Khoshgoftaar T, Chen Y (2001) Measuring coupling and cohesion of software modules: an information theory approach. In: Proceedings of the seventh international software metrics symposium, 2001

    Google Scholar 

  2. Anquetil N, Lethbridge T (1999) Experiments with clustering as a software remodularization method. In: Proceedings of WCRE ’99 (6th working conference on reverse engineering), Louis Pasteur, University of Ottawa, Ottawa, Canada, 1999, pp 235–255

    Google Scholar 

  3. Atole CS, Kale KV (2006) Assessment of package cohesion and coupling principles for predicting the quality of object oriented design. In: Proceedings of the 1st international conference on digital information management, Dec 2006, pp 1–5

    Google Scholar 

  4. Bansiya J, Davis C (1999) Class cohesion metric for object-oriented designs. J Object-Oriented Program 11(8):47–52

    Google Scholar 

  5. Bansiya J, Davis C (2002) A hierarchical model for object-oriented design quality assessment. IEEE Trans Softw Eng 28(1):4–17

    Article  Google Scholar 

  6. Basili VR, Weiss D (1984) A methodology for collecting valid software engineering data. IEEE Trans Softw Eng 10(11):728–738

    Article  Google Scholar 

  7. Basili VR, Rombach DH (1988) The tame project: towards improvement-oriented software environments. IEEE Trans Softw Eng 14(6):758–773

    Article  Google Scholar 

  8. Basili VR (1997) Evolving and packaging reading technologies. J Syst Softw 38(1):3–12

    Article  Google Scholar 

  9. Bean Scripting Framework (BSF) (2011) http://jakarta.apache.org/bsf/index.html

  10. Bieman JM, Kang BK (1995) Cohesion and reuse in an object-oriented system. In: Proceedings of the symposium on software reusability (SSR’95), Seattle, WA, 1995, pp 259–262

    Google Scholar 

  11. Bieman JM, Kang BK (1998) Measuring design-level cohesion. IEEE Trans Softw Eng 24(2):111–124

    Article  Google Scholar 

  12. Bieman JM, Ott LM (1994) Measuring functional cohesion. IEEE Trans Softw Eng 20(8):644–658

    Article  Google Scholar 

  13. Briand L, Morasca S, Basili V (1996) Property-based software engineering measurement. IEEE Trans Softw Eng 22(1):68–86

    Article  Google Scholar 

  14. Briand LC, Daly JW, Wust J (1998) A unified framework for cohesion measurement in object-oriented systems. Empir Softw Eng 3(1):65–117

    Article  Google Scholar 

  15. Briand LC, Daly JW, Wust JK (1999) A unified framework for coupling measurement in object-oriented systems. IEEE Trans Softw Eng 25(1):91–121

    Article  Google Scholar 

  16. Briand LC, Morasca S, Basili VR (1999) Defining and validating measures for object-based high-level design. IEEE Trans Softw Eng 25(5):722–743

    Article  Google Scholar 

  17. Briand L, Morasca S, Basili V (2002) An operational process for goal-driven definition of measures. IEEE Trans Softw Eng 28(12):1106–1125

    Article  Google Scholar 

  18. Brito e Abreu F (1995) The MOOD metrics set. In: Proceedings of the ninth European conf object-oriented programming workshop metrics workshop on metrics, Aarhus, Denmark, 1995

    Google Scholar 

  19. Brito e Abreu F, Goulão M (2001) Coupling and cohesion as modularization drivers: are we being over-persuaded? In: Proceedings of the 5th European conference on software maintenance and reengineering (CSMR’2001), Lisboa, Portugal, March 2001. IEEE Computer Society Press, Los Alamitos

    Google Scholar 

  20. Bryton S (2008) Modularity improvements with aspect-oriented programming. MSc Thesis (F. Brito e Abreu, supervisor), FCT/UNL

  21. Bryton S, Brito e Abreu F (2007) Towards paradigm-independent software assessment. In: Proceedings of 6th international conference on the quality of information and communications technology (QUATIC), 2007. IEEE Computer Society Press, Los Alamitos

    Google Scholar 

  22. Byte Code Engineering Library (BCEL) (2011) http://jakarta.apache.org/bcel/index.html

  23. Chae HS, Kwon YR, Bae DH (2000) A cohesion measure for object-oriented classes. Softw Pract Exp 30(12):1405–1431

    Article  MATH  Google Scholar 

  24. Chae HS, Kwon YR, Bae DH (2004) Improving cohesion metrics for classes by considering dependent instance variables. IEEE Trans Softw Eng 30(11):826–832

    Article  Google Scholar 

  25. Chidamber SR, Kemerer CF (1991) Towards a metrics suite for object oriented design. In: Proceedings of OOPSLA’91, ACM SIGPLAN Notices, 26 Nov 1991, pp 197–211

    Google Scholar 

  26. Chidamber SR, Kemerer CF (1994) A metrics suite for object oriented design. IEEE Trans Softw Eng 20(6):476–493

    Article  Google Scholar 

  27. Cohen J (1988) Statistical power analysis for the behavioral sciences, 2nd edn. Lawrence Erlbaum, Mahwah

    MATH  Google Scholar 

  28. Corbi TA (1989) Program understanding: challenge for the 1990’s. IBM Syst J 28(2):294–306

    Article  Google Scholar 

  29. Counsell S, Mendes E, Swift S (2002) Comprehension of object-oriented software cohesion: the empirical quagmire. In: Proceedings of the 10th international workshop on program comprehension, 2002, pp 33–42

    Chapter  Google Scholar 

  30. Counsell S, Swift S (2006) The interpretation and utility of three cohesion metrics for object-oriented design. ACM Trans Softw Eng Methodol 15(2):123–149

    Article  Google Scholar 

  31. DeMarco T (1982) Controlling software projects. Yourdon Press, New York

    Google Scholar 

  32. Eder J, Kappel G, Schre M (1992) Coupling and cohesion in object-oriented systems. In: Proceedings of the conference on information and knowledge. ACM Press, New York

    Google Scholar 

  33. Element Construction Set (ECS) (2011) http://jakarta.apache.org/ecs/index.html

  34. Emerson T (1984) A discriminant metric for module cohesion. In: Proceedings of the 7th international conference on software engineering (ICSE), 1984

    Google Scholar 

  35. Fenton N, Pfleeger SL (1996) Software metrics: a rigorous and practical approach, 2nd edn. International Thomson Computer Press, London

    Google Scholar 

  36. Gélinas JF, Badri M, Badri L (2006) A cohesion measure for aspects, J Object Technol 5:97–114

    Article  Google Scholar 

  37. Gosling J, Yellin F (1996) The Java application programming interface, Vol #1 (Core packages)/#2 (window toolkit and applets). Addison-Wesley, Reading

    Google Scholar 

  38. Gui G, Scott PD (2006) Coupling and cohesion measures for evaluation of component reusability. In: Proceedings of the international workshop on mining software repositories, Shanghai, China, 2006, pp 18–21

    Google Scholar 

  39. Henderson-Sellers B (1996) Object-oriented metrics: measures of complexity. Prentice-Hall, New York

    Google Scholar 

  40. Hitz M, Montazeri B (1995) Measuring coupling and cohesion in object-oriented systems. In: Proceedings of the third international symposium on applied corporate computing (ISACC’95), Monterrey, Mexico, 1995, pp 25–27

    Google Scholar 

  41. ISO/IEC 9126-1 (2000) Software product quality, Part 1: Quality model

  42. Jakarta-ORO (2011) http://jakarta.apache.org/oro/index.html

  43. JUnit (2011) http://sourceforge.net/projects/junit/

  44. Kabaili H, Keller R, Lustman F (2001) Cohesion as changeability indicator in object-oriented systems. In: Proceedings of IEEE conference on software maintenance and reengineering (CSRM), 2001, pp 39–46

    Chapter  Google Scholar 

  45. Kothari CR (2007) Research methodology: methods & techniques, revised second edn. New Age International, New Delhi, pp 139–141

    Google Scholar 

  46. Kumar A, Kumar R, Grover PS (2008) Towards a unified framework for cohesion measurement in aspect-oriented systems. In: Proceedings of the 19th Australian conference on software engineering (ASWEC ’08), 2008

    Google Scholar 

  47. Lee YS, Liang BS (1995) Measuring the coupling and cohesion of an object-oriented program based on information flow. In: Proceedings of the international conference on software quality, Maribor, Slovenia, 1995, pp 81–90

    Google Scholar 

  48. Li W, Henry S (1993) Object oriented metrics that predict maintainability. J Syst Softw 23(2):111–122

    Article  Google Scholar 

  49. Lientz B, Swanson B (1980) Software maintenance management. Addison-Wesley, Boston

    Google Scholar 

  50. Mancoridis S, Mitchell BS, Chen Y, Gansner ER (1999) Bunch: a clustering tool for the recovery and maintenance of software system structures. In: Proceedings of ICSM ’99 (international conference on software maintenance), Oxford, England, 1999

    Google Scholar 

  51. Martin R (2002) Agile software development, principles, patterns, and practices. Prentice-Hall, New York

    Google Scholar 

  52. Mišić VB (2001) Cohesion is structural, coherence is functional: Different views, different measures. In: Proceedings of the seventh international software metrics symposium (METRICS-01), 2001. IEEE Press, New York

    Google Scholar 

  53. Mitchell A, Power J (2004) An empirical investigation into the dimensions of run time coupling in Java programs. In: Proceedings of the 3rd international conference on principles and programming in Java (PPPJ’04), Las Vegas, Nevada, 2004, pp 9–14

    Google Scholar 

  54. Morris K (1989) Metrics for object-oriented software development environments. Master’s thesis, Sloan School of Management MIT

  55. OMG Unified Modeling Language (OMG UML) (2011) Infrastructure, V2.1.1, p 158

  56. Ott L, Bieman JM, Kang B, Mehra B (1995) Developing measures of class cohesion for object-oriented software. In: Proceedings of the annual Oregon workshop on software metrics (AOWSM’95), 1995

    Google Scholar 

  57. Ott LM, Bieman JM (1998) Program slices as an abstraction for cohesion measurement. Inf Softw Technol 40(11–12):691–699

    Article  Google Scholar 

  58. Patel S, Chu WC, Baxter R (1992) A measure for composite module cohesion. In: Proceedings of the 14th international conference on software engineering, 1992, pp 38–48

    Google Scholar 

  59. Ponisio L, Nierstrasz O (2006) Using contextual information to assess package cohesion. Technical Report No. IAM-06-002, 2006, Institute of Applied Mathematics and Computer Sciences, University of Berne

  60. Ponisio L (2006) Exploiting client usage to manage program modularity. University of Berne, Ph.D. Thesis

  61. Sant’Anna C, Garcia A, Chavez C, Lucena C, von Staa A (2003) On the reuse and maintenance of aspect-oriented software: an assessment framework. In: XXIII Brazilian symposium on software engineering, Manaus, Brazil, October 2003

    Google Scholar 

  62. Van Solingen R (2002) The goal/question/metric approach, encyclopedia of software engineering—2 volume set, pp 578–583

  63. Tagoug N (2002) Object-oriented system decomposition quality. In: Proceedings of 7th IEEE international symposium on high assurance systems engineering (HASE ’02), 2002, pp 230–235

    Chapter  Google Scholar 

  64. Telles M (2001) C# Black Book, The Coriolis Group, Nov 2001

  65. The Apache Jakarta Project (2011) http://jakarta.apache.org

  66. Tian J, Zelkowitz MV (1992) A formal program complexity model and its application. J Syst Softw 17:253–266

    Article  Google Scholar 

  67. Wang J, Zhou Y, Wen L, Chen Y, Lu H, Xu B (2005) DMC: a more precise cohesion measure for classes. Inf Softw Technol 47(3):167–180

    Article  Google Scholar 

  68. Weyuker EJ (1988) Evaluating software complexity measures. IEEE Trans Softw Eng 14(9):1357–1365

    Article  MathSciNet  Google Scholar 

  69. XGen Source Code Generator (2011) http://sourceforge.net/projects/xgen/

  70. Xu B, Chen Z, Zhao J (2003) Measuring cohesion of packages in Ada95. In: Proceedings of the 2003 annual ACM SIGAda international conference on Ada: the engineering of correct and reliable software for real-time & distributed systems using Ada and related technologies, San Diego, California, USA, 2003, pp 62–67

    Google Scholar 

  71. Zhao J, Xu B (2004) Measuring aspect cohesion, presented at international conference on fundamental approaches to software engineering (FASE’2004)

  72. Zhou Y, Wen L, Wang J, Chen Y (2003) DRC: a dependence relationships based cohesion measure for classes. In: Proceedings of the tenth Asia–Pacific software engineering conference (APSEC’03), 2003, pp 215–223

    Chapter  Google Scholar 

  73. Zhou Y, Lu J, Lu H, Xu B (2004) A comparative study of graph theory-based class cohesion measures. Softw Eng Notes 29(2):13

    Article  Google Scholar 

  74. Zhou T, Xu B, Shi L, Zhou Y, Chen L (2008) Measuring package cohesion based on context. In: Proceedings of the IEEE international workshop on semantic computing and systems, 2008, pp 127–132

    Chapter  Google Scholar 

  75. Zuse H (1991) Software complexity: measures and methods. de Gruyter, Amsterdam

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Varun Gupta.

Rights and permissions

Open Access This article is distributed under the terms of the Creative Commons Attribution 2.0 International License ( https://creativecommons.org/licenses/by/2.0 ), which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

Reprints and permissions

About this article

Cite this article

Gupta, V., Chhabra, J.K. Package level cohesion measurement in object-oriented software. J Braz Comput Soc 18, 251–266 (2012). https://doi.org/10.1007/s13173-011-0052-4

Download citation

  • Received:

  • Accepted:

  • Published:

  • Issue Date:

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

Keywords