Skip to main content
Log in

ACCo: a novel approach to measure cohesion using hierarchical slicing of Java programs

  • Original Paper
  • Published:
Innovations in Systems and Software Engineering Aims and scope Submit manuscript

Abstract

Maintainability of program parts refers to the ease with which these parts can be modified. Many existing metrics of internal quality attributes such as cohesion, coupling, etc. have been used in this regard. Cohesiveness among program parts is considered as a strong measure for the maintainability of object-oriented components and to predict the probability of being erroneous. Our objective is to propose a novel graph-based cohesion metric to measure the maintainability of different program parts in an object-oriented program and predict their fault proneness. We compute the cohesion of the sliced component as a measure to predict its correctness and preciseness. In addition, we wish to theoretically validate the proposed technique against the existing guidelines of cohesion measurement and compare it with some existing techniques. We propose a new cohesion metric named affected component cohesion (ACCo) to measure the maintainability of different program parts and predict their fault proneness. This metric is based on the hierarchical decomposition slice of an object-oriented program that comprises all the affected program parts. The slices are obtained with respect to some modification made to the program under consideration. It is essential to consider all possible dependence relationships along with the control and data dependences that exist between different program parts of an object-oriented program for a better program comprehension. To represent these dependences, we construct a suitable intermediate graph for an object-oriented program. Then, we compute the slice of the object-oriented program using the intermediate graph to extract the affected program parts. These extracted affected program parts are represented as nodes in the proposed affected slice graph. The critical and sub-critical nodes that require thorough testing are determined by estimating their cohesion measure. The theoretical validation signifies that ACCo satisfies all the existing properties for cohesion measurement. The results obtained are more precise and comparable with other existing approaches. ACCo is a more precise and practical technique to measure the inter-relatedness of affected program parts in an object-oriented program. The discussion on possible threats to its validity demonstrates the scope for improvement of this approach.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Institutional subscriptions

Fig. 1
Fig. 2
Fig. 3
Fig. 4
Fig. 5

Similar content being viewed by others

Notes

  1. http://www.eclipse.org/ganymede/.

  2. https://javacc.java.net/.

  3. http://www.graphviz.org/.

  4. http://www.imagix.com/products/source-code-analysis.html.

  5. http://www.w3schools.com/xpath/.

  6. http://www.w3schools.com/xsl/default.asp.

  7. Access method is defined only to retrieve or update a data member of the class.

  8. Delegation method is defined to delegate a message to an instance variable through another object.

  9. Constructor is defined to initialize the instance members.

  10. Destructor is defined to deinitialize the instance members.

References

  1. Al Dallal J (2007) Efficient program slicing algorithms for measuring functional cohesion and parallelism. Int J Inf Technol 4(2):93–100

    Google Scholar 

  2. Al Dallal J (2010) Mathematical validation of object-oriented class cohesion metrics. Int J Comput 4(2):45–52

    Google Scholar 

  3. Al Dallal J (2011) Improving object-oriented lack-of-cohesion metric by excluding special methods. In: Proceedings of the 10th WSEAS international conference on software engineering, parallel and distributed systems. World Scientific and Engineering Academy and Society (WSEAS) pp 124–129

  4. Al Dallal J (2011) Transitive-based object-oriented lack-of-cohesion metric. Procedia Comput Sci 3:1581–1587

    Article  Google Scholar 

  5. Al Dallal J (2012) Fault prediction and the discriminative powers of connectivity-based object-oriented class cohesion metrics. Inf Softw Technol 54(4):396–416

    Article  Google Scholar 

  6. Al Dallal J (2012) The impact of accounting for special methods in the measurement of object-oriented class cohesion on refactoring and fault prediction activities. J Syst Softw 85(5):1042–1057

    Article  Google Scholar 

  7. Al Dallal J (2013) Object-oriented class maintainability prediction using internal quality attributes. Inf Softw Technol 55(11):2028–2048

    Article  Google Scholar 

  8. Alomari HW, Collard ML, Maletic JI (2012) A very efficient and scalable forward static approach. In: Reverse Engineering (WCRE), 19th working conference. IEEE, pp 425–434

  9. Alomari HW, Collard ML, Maletic JI, Alhindawi N, Meqdadi O (2014) srcSlice: very efficient and scalable forward static slicing. J Softw Evol Process 26(11):931–961

    Article  Google Scholar 

  10. Badri L, Badri M (2004) A proposal of a new class cohesion criterion: an empirical study. J Object Technol 3(4):145–159

    Article  Google Scholar 

  11. Barpanda SS, Mohapatra DP (2011) Dynamic slicing of distributed object-oriented programs. IET Softw 5(5):425–433

    Article  Google Scholar 

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

    Article  Google Scholar 

  13. 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 

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

    Article  MATH  Google Scholar 

  15. Chen Z, Xu B (2001) Slicing object-oriented Java programs. ACM SIGPLAN Not 36(4):33–40

    Article  Google Scholar 

  16. Chen Z, Zhou Y, Xu B, Zhao J, Yang H (2002) A novel approach to measuring class cohesion based on dependence analysis. In: Proceedings of the international conference on software maintenance (ICSM). IEEE, pp 377–384

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

    Article  Google Scholar 

  18. Collard ML, Decker MJ, Maletic JI (2011) Lightweight transformation and fact extraction with the srcML Toolkit. In: Source code analysis and manipulation (SCAM), 2011 11th IEEE international working conference on. IEEE, pp 173–184

  19. Collard ML, Kagdi HH, Maletic JI (2003) An XML-based lightweight C++ fact extractor. In: Program comprehension, 2003. 11th IEEE international workshop on. IEEE, pp 134–143

  20. Green P, Lane PC, Rainer A, Scholz S (2009) An introduction to slice-based cohesion and coupling metrics. Technical Report SE-09-488, University of Hertfordshire

  21. Gupta V, Chhabra JK (2012) Package level cohesion measurement in object-oriented software. J Braz Comput Soc 18(3):251–266

    Article  Google Scholar 

  22. Kovács G, Magyar F, Gyimóthy T (1996) Static slicing of java programs. In: University. Citeseer

  23. Krinke J (2007) Statement-level cohesion metrics and their visualization. In: Source code analysis and manipulation (SCAM), 7th IEEE international working conference. IEEE, pp 37–48

  24. Krishnaswamy A (1994) Program slicing: an application of object-oriented program dependence graphs. Technical report TR94-108. Department of Computer Science, Clemson University

  25. Li BX, Fan XC, Pang J, Zhao JJ (2004) Model for slicing Java programs hierarchically. J Comput Sci Technol 19(6):848–858

    Article  Google Scholar 

  26. Lossing N, Guillou P, Amini M, Irigoin F (2015) From data to effects dependence graphs: source-to-source transformations for C. In: The 18th international workshop on compilers for parallel computing (CPC’15)

  27. Meyers TM, Binkley D (2007) An empirical study of slice-based cohesion and coupling metrics. ACM Trans Softw Eng Methodol (TOSEM) 17(1):2

    Article  Google Scholar 

  28. Mohapatra DP, Mall R, Kumar R (2005) Computing dynamic slices of concurrent object-oriented programs. Inf Softw Technol 47(12):805–817

    Article  Google Scholar 

  29. Mohapatra DP, Mall R, Kumar R (2006) An overview of slicing techniques for object-oriented programs. Inform (Slov) 30(2):253–277

    MATH  Google Scholar 

  30. Panda S, Mohapatra DP (2013) Application of hierarchical slicing to regression test selection of Java programs. Model Based Softw Eng Some Perspect Infosys Labs Brief 11(2):3–19

    Google Scholar 

  31. Rilling J, Klemola T (2003) Identifying comprehension bottlenecks using program slicing and cognitive complexity metrics. In: 11th IEEE international workshop on program comprehension. IEEE, pp 115–124

  32. Romano D, Pinzger M (2011) Using source code metrics to predict change-prone Java interfaces. In: Software maintenance (ICSM), 2011 27th IEEE international conference on. IEEE, pp 303–312

  33. Silva B, Sant’Anna C, Chavez C, Garcia A (2012) Concern-based cohesion: unveiling a hidden dimension of cohesion measurement. In: IEEE 20th international conference on program comprehension (ICPC). IEEE, pp 103–112

  34. da Silva BC, Sant’Anna C, Chavez C (2011) Concern-based cohesion as change proneness indicator: an initial empirical study. In: Proceedings of the 2nd international workshop on emerging trends in software metrics. ACM, pp 52–58

  35. da Silva BC, Sant’Anna CN, Chavez CvF (2014) An empirical study on how developers reason about module cohesion. In: Proceedings of the 13th international conference on modularity. ACM, pp 121–132

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

    Article  Google Scholar 

  37. Wang D, Dong M, Zhan W (2013) An input data related behavior extracting and measuring model. Int J Appl Math Inf Sci 7(2):683–689

    Article  Google Scholar 

  38. Wang T, Roychoudhury A (2004) Using compressed bytecode traces for slicing Java programs. In: 26th international conference on software engineering (ICSE’04). ACM, pp 512–521

  39. Weiser M (1981) Program Slicing. In: Proceedings of the 5th international conference on software. San Diego, pp 439–449

  40. Wen W (2012) Software fault localization based on program slicing spectrum. In: Proceedings of the international conference on software wngineering. ACM, pp 1511–1514

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

    Article  MathSciNet  Google Scholar 

  42. Yoshida N, Kinoshita M, Iida H (2012) A cohesion metric approach to dividing source code into functional segments to improve maintainability. In: Software maintenance and reengineering (CSMR), 16th European conference on. IEEE, pp 365–370

  43. Yu P, Systa T, Muller H (2002) Predicting fault-proneness using OO metrics. An industrial case study. In: Proceedings of software maintenance and reengineering, 2002, Sixth European conference on. IEEE, pp 99–107

  44. Zhao J (1998) Applying program dependence analysis to java software. In: Proceedings of workshop on software engineering and database systems, 1998, international computer symposium. Citeseer, pp 162–169

  45. Zhao J, Cheng J, Ushijima K (1998) A dependence based representation for concurrent object-oriented software maintenance. In: Proceedings of 2nd Euromicro conference on software maintenance and reengineering, pp 60–66

  46. Zhou Y, Wen L, Wang J, Chen Y, Lu H, Xu B (2003) DRC: a dependence relationships based cohesion measure for classes. In: Software engineering conference. Tenth Asia-Pacific. IEEE, pp 215–223

  47. Zhou Y, Xu B, Zhao J, Yang H (2002) ICBMC: an improved cohesion measure for classes. In: Software maintenance, 2002. Proceedings of international conference. IEEE, pp 44–53

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to S. Panda.

Rights and permissions

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Panda, S., Mohapatra, D.P. ACCo: a novel approach to measure cohesion using hierarchical slicing of Java programs. Innovations Syst Softw Eng 11, 243–260 (2015). https://doi.org/10.1007/s11334-015-0252-8

Download citation

  • Received:

  • Accepted:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s11334-015-0252-8

Keywords

Navigation