Software Metrics

Software metrics are essential to improve the quality of an application during the development process. Coupling and Cohesion measures are used in tasks such as impact analysis, assessing the fault proneness of classes, fault Prediction, re-modularization, identifying of software component, design patterns, assessing software quality etc.High Cohesion and low Coupling is better for good software quality. Coupling and Cohesion is applied at the early phase of the development. Coupling and cohesion is applied at the opposite end. This paper reviews Coupling and Cohesion metrics used in Object Oriented environment.

Key words: - Software Metrics, Coupling, Cohesion,
Correlation, Interdependence.

1.INTRODUCTION
In field of Software engineering Coupling and Cohesion measures the degree or the strength of interaction and relationships among elements of the source code, elements can be classes, methods, and attributes in object-oriented (OO) software systems [1].

Stevens et al. first introduced Coupling. According to definition of him 'Coupling is the measure of the strength of association established by a connection from one module to another' [2].To solve and modify a module separately, the module to be loosely coupled with other module. Reusability and Maintainability are the advantages of low coupling [3]. Cohesion is also defined by Stevens. In their definition 'Cohesion can

advantages of low coupling[3]. Cohesion was first introduced by Stevens 'Cohesion can be measured by inspecting the connection between all pairs of its processing elements' [4]. Reusability, Maintainability and Extensibility are advantages of high Cohesion [5]. Following tables describe the levels of Coupling and Cohesion [2].

Content(High) Where two modules branches into, changes data or alters a statement in another modules
Common Where two modules access the same global variables.
External Where two modules access heterogeneous
Global data.
Control Where one module passes a parameter to a second module to control behavior in the second module.
Stamp Where two modules accept the same record as a parameter.
Data Where two modules communicate via parameters.
No coupling Modules do not
Communicate at all with one another.

Table1:Coupling levels



Level Description

No association between two processing elements.
1 Coincidental
2 Logical At each invocation of the module, one of the elements is executed
3 Classical Weak association among sequential elements.
4 Procedural Both elements are sequentially part of the same iteration or operation.
5 Communicational Both elements use the same input and/or output data set.
6 Sequential The output of one element provides the input to another.
7 Functional The elements perform a single specific function.

Table2: Cohesion levels

2. REVIEW OF COUPLING METRICS

STATIC COUPLING METRICS
Different-different Coupling metrics were purposed by many authors .Each metric has own definition.

2.1 Chidamber and Kemerer Metrics [6,7] C&K metrics are most accepted and widely used metrics.

[2.1.1] Coupling between Object (CBO) Classes is the number of other classes with which a class is coupled to. A class is coupled with another class if the methods of class use the methods or attributes of the other or vice versa. It include inheritance based coupling (i.e. coupling between classes related via inheritance). A previous variant of CBO excludes inheritance-based coupling.
[2.1.2] Response for class (RFC)
RFC = | RS | where RS is the response set for the class. The response set for the class can be expressed as:
RS = { M }''all i { Ri }
Where { Ri } = set of methods called by method i and { M } = set of all methods in the class.
The response set of a class = A set of methods that can potentially be executed in response to a message received by an object of that class. The cardinality of this set is a measure of the attributes of objects in the class.

2.2 Li and Henry Metrics [8]Li and Henry's metrics can predict the maintainability of a software design. They define two measures:-
[2.2.1]Message passing coupling (MPC) is the total number of function and procedure calls to made to external unit.
[2.2.2] Data abstraction coupling (DAC) is count of total number of instance of other classes within a given class.
2.3 Abreu et al.[9]. Coupling Factor (COF) for the design quality evaluation of object-oriented software systems.COF can be defined as the actual number of client-server relationships between classes that are not related via inheritance divided by the maximum possible number of such client-server relationships. It is normalised to range between 0 and 1 to allow for comparisons for systems of different sizes. This metric not specified how to account for such factors as polymorphism.
2.4 Martin Metrics [10]. Martin gave two coupling metrics and these metrics can be used to measure the quality of an object-oriented design in terms of the interdependence between the subsystems of that design.
[2.4.1] Afferent Coupling (Ca) is the number of classes outside this category that depend upon classes within this category. Afferent coupling is used to measure the quality of an object-oriented design in terms of the interdependence between the subsystems of that design.

[2.4.2] Efferent Coupling (Ce) is the number of classes inside this category that depend upon classes outside this category. Where, a category is a set of classes that belong together in the sense that they achieve some common goal. Martin does not specify exactly what constitutes dependencies between classes.

2.7 Bansiya et al. QMOOD [11] purposed Direct Class Coupling Metric (DCC). It is a count of different number of classes that a class is directly related to.

2.8 Chen et al. [12] Metrics used to know the behaviour of metrics in Object-Oriented design.
[2.8.1]Class Coupling Metric (CCM)
[2.8.2]Operating Coupling Metric (OCM)

RUNTIME/DYNAMIC COUPLING MEASURE
2.9 Yacoub et al.[13] Yacoub proposed a set of dynamic metrics. These are following.
[2.9.1]Export Object Coupling (EOCx(oi; oj)) for an object oi with respect to an object oj, is defined as the percentage of the number of messages sent from oi to oj with respect to the total number of messages exchanged during the execution of scenario x.

[2.9.2]Import Object Coupling (IOCx(oi; oj)) for an object oi with respect to an object oj , is the percentage of the number of messages received by object oi that were sent by object oj with respect to the total number of messages exchanged during the execution of a scenario x.

2.10 Arisholm et al.[14] List of number of dynamic coupling metrics defined by Arisholm et al. Each dynamic coupling metric name starts with either I or E based on the direction of the method calls. Here 'I' stands for import or 'E' stands for export. The third letter C or O distinguishes whether entity of measurement is the object or the class. The remaining letter distinguishes three types of coupling.

Variable Description

IC CC Import, Class Level, Number of Distinct Classes
IC CM Import, Class Level, Number of Distinct Methods
IC CD Import, Class Level, Number of Dynamic Messages
EC CC Export, Class Level, Number of Distinct Classes
EC CM Export, Class Level, Number of Distinct Methods
EC CD Export, Class Level, Number of Dynamic Messages
IC OC Import, Object Level, Number of Distinct Classes
IC OM Import, Object Level, Number of Distinct Methods IC OD Import, Object Level, Number of Dynamic Messages
EC OC Export, Object Level, Number of Distinct Classes
EC OM Export, Object Level, Number of Distinct Methods
EC OD Export, Object Level, Number of Dynamic Messages

Table3:-Abbreviations for the dynamic coupling metrics of Arisholm et al.

C = counts the number of distinct classes that a method in a given class/object uses or is used by.
M = counts the number of distinct methods invoked by each method in each class/object while
D = counts the total number of dynamic messages sent or received from one class/object to or from other classes/objects.

2.11 Hassoun et al[15] Dynamic Coupling Metric (DCM) was purposed by Hassoun et al.It is used to measure the coupling of particular objects and/or the entire system at runtime. The DCM is also used to predict the runtime complexity of a system.

2.12 Beszedes et al. [16] Dynamic Function Coupling (DFC) may be defined as the minimal level of indirection between all possible occurrences of the two functions in the traces.

2.13 Singh et al.[17] Singh and Singh proposed five class-level dynamic coupling metrics to assess the quality of object oriented software systems.
[2.13.1]Dynamic Afferent Coupling (DCa) the percentage of number of classes accessing the methods of a class at runtime to the total number of classes.
[2.13.2] Dynamic Key Server Class (DKSC) the percentage of number of calls sent to a class at runtime to the total number of static calls sent to all the classes.'
[2.13.3] Dynamic Key Client Class (DKCC)the percentage of number of calls sent by a class at runtime to the total number of static calls sent by all the classes.
[2.13.4] Dynamic Key Class (DKC) the percentage of sum of calls sent out from the class and calls received by the class at runtime taken over the total number of static calls sent and received by all the classes.
[2.13.5] Percentage Active Classes (PAC) the percentage of number of classes sending or receiving at least one method calls from/to another class at runtime to the total number of classes.
REVIEW OF COHESION METRICS

2.14 Chidamber and Kemerer Metrics [19]

[2.14.1]The Lack of Cohesion in Methods (LCOM1) the metric was proposed by Chidamber and Kemerer. LCOM1 is defined by the number of pairs of methods that do not share attributes.
[2.14.2]The metric was proposed by Chidamber and Kemerer.
LCOM2= P ' Q if P ' Q'0
0 otherwise.
Where, P=number of pairs of methods that do not share attributes. And Q=number of pair of methods that share attributes.

2.12Briand et al. Metrics [20] purposed high level design metrics for Object-Oriented system.
[2.15.1]Ratio of Cohesive Interactions (RCI)
The Ratio of Cohesive Interactions for sp is
RCI(sp) = |CL(sp)|

| M(sp) |
Where,CL(m)=The set of cohesion interaction in a module m.
M(sp)=The maximal set of cohesive interaction of the software part(sp) i.e. the set of includes all of sp's possible cohesion interaction.
This metric satisfies the properties of Normalization, Monotonicity, Cohesive modules.
[2.15.2] Neutral Ratio of Cohesive Interactions (NRCI).
Unknown CLs are not taken into account
NRCI(sp) = | K(sp)|
| M(sp)-|U(sp)|
Where, K(sp) = The set of known interactions of a software part (sp)
U(sp) = The set of unknown interaction.
[2.15.3] Pessimistic Ratio of Cohesive Interaction (PRCI).
Unknown CLs are considered as if they were known not to be actual interactions.
PRCI(sp) = | K(sp)|
| M(sp)|
This is equal to RCI(sp)
[2.15.4] Optimistic Ratio of Cohesive Interactions (ORCI).
ORCI = | K(sp)+|U(sp)|
| M(sp) |
2.16 Bieman and Kang Metrics [18]Their work was also based on the work of Chidamber and Kemerer. Defined measurements known as:-
[2.16.1]Tight Class Cohesion (TCC)-is the relative number of directly connected pairs of methods, wherein two methods are directly connected if they are directly connected to an attribute.

[2.16.2]Loose Class Cohesion (LCC) - LCC defines the relative number of directly or transitively connected pairs of methods, wherein two methods are transitively connected if they are directly or indirectly connected to an attribute.

2.17 Li and Henry [18] LCOM3 is the number of connected components in graph that represents each method as a node and the sharing of at least one attribute as an edge.

2.18 Hitz and Montazeri [18] purposed LCOM4. It is similar to LCOM3, and additional edges are used to represent method invocations.

2.19Henderson-Sellers [19] proposed a cohesion measure (LCOM5).
LCOM5= (kl-a) (kl-l)
Where, l=number of attributes
k=number of methods
a=summation of the number of distinct attributes that are accessed by each method in a class.

2.20 Xu and Zhou Metric [21] Improved Cohesion Based on Member Connectivity (ICBMC):
ICBMC (G) = Fc(G) ?? Fs(G)
Where, Fc (G) ='M (G)'/'N(G)'
M (G) = number of edges in the cut set of G,
N (G) = number of non-special methods represented in graph G multiplied by the number of
attributes.
Fs (G) = [??ni =ICBMC (Gi)]/ 2

2.21 Yang Metric [22] gave their OLn measure. It is defined as the average strength of attributes, wherein the strength of the attribute is the average strength of the methods that reference that attribute. Where 'n' is the number of iterations that are used to compute OL.

2.22 Badri et al.[23]purposed two metrics for Object-Oriented system.
[2.19.1] DCo- It defines the relative number of directly connected pairs of methods.

[2.19.2] DCi-It defines the relative number of directly or transitively connected pairs of methods.

2.23 Bonja et al.[18] Class Cohesion (CC) metric is the ratio of the summation of the similarities between all pairs of methods to the total number of pairs of methods. The similarity between methods i and j is:
Similarity (I ,j) =| li ' lj /li U lj |
where, li , lj = sets of attributes that are referenced by methods i and j, respectively

2.24 Fernandez et al. [24] purposed Class Cohesion metric (SCOM).This metric is the ratio of the summation of the similarities between all pairs of methods to the total number of pairs of methods. The similarity between methods i and j is defined as:
Similarity (i,j) =| li ' lj| .| li U lj|

2.25 Jehad Al Dallal Metrics [18] purposed Path Connectivity Class Cohesion (PCCC)

PCCC = 0 if l = 0 and k >1,
1 if l > 0 and k = 0,
NSP (Gc )/ NSP(FGc) otherwise.
Where, l=no. of attributes
K=no. of methods
NSP = number of simple paths in graph Gc
FGc = corresponding fully connected graph

2.26Michael Bowman et al. [25] proposed an approach based on a multi-objective genetic algorithm (MOGA) which uses class coupling and cohesion measurement for defining fitness functions. Their work has some similarity with refactoring. They did most of the work on source code refactoring, though it is believed that refactoring achieves higher levels of abstraction, such as refactoring of UML models

2.27 Jehad et al. [18] purposed Method-Method through Attributes Cohesion (MMAC)
MMAC(C) = 0 if l = 0 and k =0,
1 if k = 1,
??li=1xi(xi-1) otherwise
lk(k-1)
where,
l = no. of attributes
k = no. of methods
xi = number of methods that have a or a return type j.

RUNTIME/DYNAMIC COHESION MEASURE
2.28 Gupta et al. Metrics [26,27] Bieman and Ott [26]purposed the concept of Strong Functional Cohesion and Weak Functional Cohesion and their work is redefined by Gupta et al. [27].Gupta et al commence the dynamic cohesion measurement using program execution based approach on the basis of dynamic slicing.

2.30 Mitchell et al. [1] provide a new technique for collecting dynamic trace information from Java GUI programs and a number of simple runtime metrics are proposed.
[2.30.1]The exPubMet.Ob metric gives an estimation of level of coupling present in a GUI program and The
[2.30.2]priMet.ob metric shows that simple programs devote a greater proportion of their method access to the internal working of their classes than the GUI program.

3.CONCLUSION AND FUTURE WORKS
This paper does not purpose new measure. This is only a review paper. Some Coupling and Cohesion Metrics are discussed. These metrics can be helpful for researcher and developer. Future work can be on more metrics which are not discussed in this paper. We have discussed a few dynamic metrics.So researchers can do work on dynamic metrics.

4.REFERENCES

1) Shweta Sharma, Dr. S. Srinivasan, 'A review of Coupling and Cohesion metrics in Object Oriented Environment', International Journal of Computer Science &Engineering Technology, vol 4,no-8,2013.
2) Sikha Gautam, Rekha Singh, S.B Singh Yadav, 'Coupling and Cohesion', InternationaljournalComputerTechnology&Application, vol 4,no-1, pp.155-161,2013.
3) Kailash Patidar et al., 'Coupling and Cohesion measures in Object Oriented Programming',International Journal of Advanced Research in Computer Science and Software Engineering,vol.3,no-3,March 2013.
4) W.P. Stevens, G.J. Myers, and L. L. Constantine. Structured design. IBM Systems Journal, 13(2):115-139, 1974.
5) Pressman,Roger S.Ph.D(1982)-Software Engineering-A Practitioner's Approach, Fourth Edition,ISBN 0-07-052182-4.
6) S.R. Chidamber and C.F. Kemerer., 'Towards a metrics suite for object-oriented design', In Object Oriented Programming Systems Languages and Applications, Phoenix, Arizona, USA, November 1991,pp.197-211.
7) S.R. Chidamber and C.F. Kemerer., 'A metrics suite for object-oriented design', IEEE Transactions on Software Engineering, vol.20 (6), June1994, pp.467-493.
8) W. Li and S. Henry., 'Object-oriented metrics that predict maintainability', The Journal of Systems and Software, vol.23, no.2, pp.111-122.
9) F. Abreu, M. Goulo, and R. Esteves., ' Toward the design quality evaluation of object-oriented software systems,' In Fifth International Conference on Software Quality, Austin, Texas, USA, pp.44-57,Oct 1995.
10) R. Martin. OO design quality metrics, 'An analysis of dependencies',In Proceedings Workshop on Pragmatic and Theoretical Directions in Object-Oriented Software Metrics, 1994.
11) Jagdish Bansiya and Carl G. Davis 2002., ' A Hierarchical Model for Object-Oriented Design Quality',IEEE Transactions on Software Engineering, Volume 28, Issue 1, pp. 4-17.
12) Chen J.Y Lum: "A New Metrics for Object-Oriented Design."Information of Software Technology 35, 4(April 1993):232-240.
13) S.M. Yacoub, H.H. Ammar, and T. Robinson., 'Dynamic metrics for object oriented designs', In Software Metrics Symposium, Boca Raton,Florida, USA,pp. 50-61 Nov 1999.
14) E. Arisholm, L.C. Briand, and A. Foyen., 'Dynamic coupling measures for object- oriented software', IEEE Transactions on Software,vol. 30,no.-8,pp. 491-506,2004.
15) Y. Hassoun, R. Johnson, S. Counsell., 'A Dynamic Runtime Coupling Metric for Meta Level Architectures', In Proceedings of Eighth Euromicro Working Conference on Software Maintenance and Reengineering (CSMR '04), pp. 339, 2004.
16) A. BeszedesT. Gergely S. Farago., ' Dynamic Function Coupling Metric and Its Use in Software Evolution',In Proceedings of the Eleventh European Conference on Software Maintenance and Reengineering(CSMR),IEEE Computer Society, Washington DC, 2007,pp. 103-112
17) P. Singh H. Singh., 'Class-level Dynamic Coupling Metrics for Static and Dynamic Analysis of Object-Oriented Systems', International Journal of Information and Telecommunication Technology, vol.1,no.1,2010,pp.16-28.
18) Amandeep et al., 'Class Cohesion Metrics in Object Oriented System',International Journal of Software and Web Sciences,vol 3,no-2, December, pp. 78-82,2013.
19) Henderson-Sellers, B., 'Object-Oriented Metrics Measures of Complexity', 1996, Prentice-Hall.
20) L.C. Briand, S. Morasca, and V. Basili., ' Defining and validating high-level design metrics',Technical Report CS-TR 3301, Department of Computer Science, University of Maryland, College Park, MD 20742, USA, 1994.
21) Xu, B., Zhou, Y., 'Comments on 'A cohesion measure for object-oriented classes', Software: Practice & Experience, vol. 31, 2001, 1381'1388.
22) Yang, X., 'Research on Class Cohesion Measures.', M.S. Thesis. Department of Computer Science and Engineering, Southeast University, 2002.
23) Badri M. and Badri L., 'A proposal of a new class cohesion criterion: an empirical study', Journal of object Technology, vol. 3, 2004, 145-159.
24) Fern??ndez, L., Pena, R., 'A sensitive metric of class cohesion', International Journal of Information Theories and Applications, vol. 13, 2006, 82'91.
25) Bowman M., Briand L.C. and Labiche Y. (2010) ,IEEE Transac-tions on Software Engineering, pp.1-50.
26) Bieman J M, Ott L M., 'Measuring functional cohesion', IEEE Transactions on Software Engineering, 1994, 20(8): 644-657.
27) Gupta N, Rao P. , 'Program execution based module cohesion measurement', In Proc. the 16th International Conference on Automated on Software Engineering (ASE 2001), San Diego, USA, Nov. 26-29, 2001, pp.144-153.

Source: Essay UK - http://doghouse.net/free-essays/information-technology/software-metrics.php


Not what you're looking for?

Search:


About this resource

This Information Technology essay was submitted to us by a student in order to help you with your studies.


Rating:

Rating  
No ratings yet!


Word count:

This page has approximately words.


Share:


Cite:

If you use part of this page in your own work, you need to provide a citation, as follows:

Essay UK, Software Metrics. Available from: <http://doghouse.net/free-essays/information-technology/software-metrics.php> [22-02-19].


More information:

If you are the original author of this content and no longer wish to have it published on our website then please click on the link below to request removal:


Essay and dissertation help

badges