Professional Documents
Culture Documents
Software Metrics
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.
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].
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
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)
[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.
Variable Description
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.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.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.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)
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.
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.