Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Utilization of Method Graphs to Measure Cohesion in Object Oriented Software

The primarily used technique in measuring cohesion in an object oriented software is analyzing the relations between methods and data members of the software classes. However, extraction of such relations is rather problematic since the usage of data members can vary heavily in program code. Object code analysis is a widely used technique to solve this problem which requires the compilation of the source code. In this paper, we analyze the relations between various method graphs (including call graphs) which can be easily obtained by static source code analysis to obtain software-wide cohesion measures. We perform our analysis to discover the relationship between a widely used cohesion metric, namely LCOM, and the relation among method graphs. This way, we provide cohesion measures that can be extracted rapidly and easily compared to conventional techniques. Proposed measures can be used to obtain information about overall degree of cohesion which in turn can let the designer infer about the quality concerns like modularity and reusability of an object oriented software. Our results show that using different kind of relations in such analysis provides significantly different results in evaluating software-wide average class cohesion. Using graphs involving cooperating methods provide the most correlated results with the LCOM metric.

http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=6605841

  • Be the first to comment

Utilization of Method Graphs to Measure Cohesion in Object Oriented Software

  1. 1. Utilization of Method Graphs to Measure Cohesion in Object Oriented Software Atakan Aral, Tolga Ovatman Istanbul Technical Universtiy Faculty of Computer and Informatics
  2. 2. Outline • Introduction • Motivation • Contribution • Method Graphs • Clustering & Similarity Measurement • Results & Discussion • Conclusion • Future Work
  3. 3. Introduction • Cohesion is the harmony of software components in performing responsibilities • Hard to measure quantitatively • Cohesion of a class is usually measured by examining common data usage of its methods
  4. 4. Motivation • Conventional techniques analyze object code and require compilation • Hard to detect data usage from source code – Indirect ways to access a variable • Prevents evaluating incomplete code • Our aim is to derive a pure source code based cohesion measure
  5. 5. Contribution Source Code Parsing •Abstract Syntax tree based Java Parser Graph Extraction •Java Universal Network/Graph Graph Clustering •Weak Component Clustering Similarity Measurement •Adjusted Rand Index Correlation Analysis •Pearson Correlation • A cohesion measure that – depends purely on static analysis – considers only method-to-method relations – is graph based and software-wide – is highly correlated to LCOM metric
  6. 6. Method Graphs • Cooperating Methods (CM) relation – involves method couples that are called together from another host method. Class A{ MA1(){ MA2(); B.MB(); } MA2(){ B.MB(); MA3(); MA4(); } MA3(){} MA4(){} } MB MA1MA2 MA3 MA4
  7. 7. Method Graphs • Method Call (MC) relation – involves method couples that call one another. Class A{ MA1(){ MA2(); B.MB(); } MA2(){} MA3(){ MA4(); } MA4(){ MA1(); } } MB MA1MA2 MA3 MA4
  8. 8. Method Graphs • Method Layout (ML) relation – involves method couples that are in the same class. Class A{ MA1(){} MA2(){} MA3(){} MA4(){} } Class B{ MB1(){} MB2(){} } MA1 MA1MA2 MB1 MA4 MB2
  9. 9. Method Graphs • Internal Call (IC) relation – involves method couples that call one another and are in the same class. Class A{ MA1(){ MA2(); B.MB(); } MA2(){} MA3(){ MA4(); } MA4(){ MA1(); } } MB MA1MA2 MA3 MA4
  10. 10. Clustering & Similarity • 4 graphs are clustered using Weak Component Clustering • 6 clustering couples are compared using adjusted Rand index – CM—MC: Are the methods calling each other, also called together from another body? – IC—ML: What is the level of fragmentation within classes?
  11. 11. Results & Discussion • 14 most popular open-source Java projects from GitHub and SourceForge
  12. 12. Results & Discussion
  13. 13. Results & Discussion • Calling two methods, that call each other, from the body of another method, decreases the overall cohesion of software
  14. 14. Conclusion • We suggest a novel technique that allows to measure software-wide cohesion. • It uses static source code analysis. • Results indicate that its correlation to LCOM HS is 77%.
  15. 15. Future Work • to adapt our measure to class level • to use direction—weight data to improve accuracy • to build a mathematical basis for the relation between our measure and the LCOM metric • to study on the other correlated groups
  16. 16. Thank you!

    Be the first to comment

    Login to see the comments

  • schjus

    Aug. 26, 2016

The primarily used technique in measuring cohesion in an object oriented software is analyzing the relations between methods and data members of the software classes. However, extraction of such relations is rather problematic since the usage of data members can vary heavily in program code. Object code analysis is a widely used technique to solve this problem which requires the compilation of the source code. In this paper, we analyze the relations between various method graphs (including call graphs) which can be easily obtained by static source code analysis to obtain software-wide cohesion measures. We perform our analysis to discover the relationship between a widely used cohesion metric, namely LCOM, and the relation among method graphs. This way, we provide cohesion measures that can be extracted rapidly and easily compared to conventional techniques. Proposed measures can be used to obtain information about overall degree of cohesion which in turn can let the designer infer about the quality concerns like modularity and reusability of an object oriented software. Our results show that using different kind of relations in such analysis provides significantly different results in evaluating software-wide average class cohesion. Using graphs involving cooperating methods provide the most correlated results with the LCOM metric. http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=6605841

Views

Total views

605

On Slideshare

0

From embeds

0

Number of embeds

3

Actions

Downloads

8

Shares

0

Comments

0

Likes

1

×