External views on class cohesion

  • Authors:
  • Sami Mäkelä;Ville Leppänen

  • Affiliations:
  • University of Turku;University of Turku

  • Venue:
  • CompSysTech '07 Proceedings of the 2007 international conference on Computer systems and technologies
  • Year:
  • 2007

Quantified Score

Hi-index 0.00

Visualization

Abstract

Several cohesion metrics measuring quality of object-oriented programs have been proposed recently. Typically some kind of bipartite usage graph is calculated between methods of a class and its variables, and interpretations of what constitutes methods, variables, usage relation and calculation method have served as sources of variation. By advancing the usage of instance variables by the instance methods to measure relatedness of the class properties, the values given by metrics depend on implementation choices -- how the contents of an object is presented as instance variable values. Another problem is that objects often consist of property sets that are only slightly related internally, but clients of objects make such connections between the property sets by advancing internally seemingly unrelated property sets simultaneously. In this paper, we propose forming cohesion graphs between the clients of a class and its abstract properties. Since abstract properties are usually not specified in program code, in practice we use the actual instance variables instead. Our approach complements the internal cohesion view with external views based on the external usage of class properties. We show results for some parts of the Java SDK 5.0 library.