Transcript View Points

Metrics for Object Oriented Design
Shyam R. Chidamber
Chris F. Kemerer
Presented by
Ambikadevi Damodaran.
Introduction
Existing OO Design metrics are subject to one or more
criticism.
There are lot of ongoing research for new suite of metrics
for OO design.
Four Major steps involved in Object Oriented Design
are
1.Identifying Classes.
2.Identifying the semantics of classes.
3.Identifying relationships between Classes.
4.Implementation of classes.
Different Representations of OOD
1.D = (A,R1…Rn, O1…..Om)
A is a set of Object-elements,
R1..Rn are relations,
O1..Om are operations on A.
2.Viewed as collection of things with properties.
Important properties Coupling and Cohesion are derived
based on the above representations.
Metric 1. Weighted Methods Per
Class(WMC)
Let a class be C1 with methods M1..Mn. Let c1…cn be the complexity of the
methods. Then
WMC = Summation of complexity c1…cn
View Points
1.The Number of methods and complexity of methods involved is a
predicator of how much time and effort is required to develop and maintain
the class.
2.The larger the number of methods in a class the greater the potential
impact on children, since children will inherit all the methods defined in the
class.
3.Classes with large numbers of methods are likely to be more application
specific, limiting the possibility of reuse.
Metric 2. Depth of Inheritance(DIT)
Depth of inheritance of the class is the DIT metric for the class.
DIT is a measure of how many ancestor classes can potentially
affect this class.
View points
1.The deeper a class is in the hierarchy, the greater the number of
methods it is likely to inherit making it more complex.
2.Deeper trees constitute greater design complexity, since more
methods and classes are involved.
3.The deeper a particular class is in the hierarchy, the greater the
potential reuse of inherited methods.
Metric 3. Number of Children
It is a measure of how many subclasses are going to inherit the methods
of the parent class.
Viewpoints
1.Greater the number of children, greater the reuse, since the
inheritance is a form of reuse.
2.Greater the number of children, the greater the likelihood of improper
abstraction of the parent class. If a class has a large number of children,
it may be a case of misuse of sub classing.
3. The number of children gives an idea of the potential influence a class
has on the design. If a class has a large number of children, it may
require more testing of the methods in that class.
Metric 4. Coupling between object classes
Objects are coupled if one of them acts on the other.
Viewpoints
1.More independent the class is, the easier it is to
reuse.
2.The larger the number of couples, the maintenance is
more difficult.
3.The higher the inter-object class coupling the testing
is more rigorous.
Metric 5. Response for a class(RFC)
The response set of a class is a set of methods that can potentially
be executed in response to a message received by an object of that
class.
View points
1.With more number of methods, testing and debugging is more
complicated.
2.The larger the number of methods that can be invoked from a
class, the greater the complexity of the class.
Metric 6 Lack of Cohesion in
Methods(LCOM)
Lack of cohesion means, classes are not properly
encapsulated, so it means the classes can be split into
one or more subclasses.
View Points
1.Low cohesion means increased complexity.
2.Low cohesion also increases the likelihood of errors.
Conclusion
1.These metrics reflects the viewpoints of OO
developers.
2.These metrics can be used as a vehicle to address
consistency of entire application.
3.By applying metrics, the areas that needs more
testing can be identified.
4.Any one of the metrics can be chosen depending on
the needs of the organization.