Anda di halaman 1dari 12

Chidamber & Kemerer

Suite of Metrics

1
CK Metrics: Outline

• Objective

• Definition & Guidelines

• Thresholds

• CK in the literature (other uses)

2
CK Metrics: Objective

CK metrics were designed :

• To measure unique aspects of the OO approach.

• To measure complexity of the design.

• To improve the development of the software

3
Object metrics
• Some of traditional metrics are useful with oo software:
• size measures for methods and classes
• complexity measures for methods
• comment percentage
• But new metrics are necessary for oo features (inheritance,
polymorphism, etc.)
• Metrics suite: set of metrics to measure different aspects of software.
E.g.:
• MOOD (Metrics for Object Oriented Design)
• The CK Metrics Suite (Chidamber & Kemerer)
• Metrics Proposed by Lorenz and Kidd
The CK Metrics Suite (1994)

One of most referenced set of metrics


Six metrics measuring class size and complexity, use of
inheritance, coupling between classes, cohesion of a class and
collaboration between classes
CK Metrics: Objective
SW development Improvement
Managers can improve the development of the SW by :

• Analysing CK metrics through the identification of


outlying values (extreme deviations), which may be a
signal of:
– high complexity and/or
– possible design violations

• Taking managerial decisions, such as:


Re-designing and/or assigning extra or higher skilled
resources (to develop, to test and to maintain the SW).
6
CK Metrics: Definition
WMC (Weighted Methods per Class)
• Definition
– WMC is the sum of the complexity of the methods of a class.
– WMC = Number of Methods (NOM), when all method’s complexity are
considered UNITY.

• Viewpoints

– WMC is a predictor of how much TIME and EFFORT is required to


develop and to maintain the class.

– The larger NOM the greater the impact on children.

– Classes with large NOM are likely to be more application specific,


limiting the possibility of RE-USE and making the EFFORT expended
one-shot investment.

7
CK Metrics: Definition
DIT (Depth of Inheritance Tree)
• Definition
The maximum length from the node to the root of the tree

• Viewpoints
The greater values of DIT :
– The greater the NOM it is likely to inherit, making more COMPLEX to
predict its behaviour
– The greater the potential RE-USE of inherited methods

 Small values of DIT in most of the system’s classes may be an indicator


that designers are forsaking RE-USABILITY for simplicity of
UNDERSTANDING.

8
CK Metrics: Definition
NOC (Number of Children)
• Definition
Number of immediate subclasses subordinated to a class in the class
hierarchy

• Viewpoints
The greater the NOC is:
– the greater is the RE-USE
– the greater is the probability of improper abstraction of the parent
class,
– the greater the requirements of method's TESTING in that class.

 Small values of NOC, may be an indicator of lack of communication


between different class designers.

9
CK Metrics: Definition
CBO (Coupling Between Objects)
• Definition
It is a count of the number of other classes to which it is coupled

• Viewpoints

Small values of CBO :


– Improve MODULARITY and promote ENCAPSULATION
– Indicates independence in the class, making easier its RE-USE
– Makes easier to MAINTAIN and to TEST a class.

10
CK Metrics: Definition
RFC (Response for Class)

• Definition
It is the number of methods of the class plus the number of methods
called by any of those methods.

• Viewpoints
If a large numbers of methods are invoked from a class (RFC is high):
– TESTING and MAINTANACE of the Class becomes more COMPLEX.

11
CK Metrics: Definition
LCOM (Lack of Cohesion of Methods)

• Definition
Measures the dissimilarity of methods in a class via instanced variables.

• Viewpoints
Great values of LCOM:
– Increases COMPLEXITY
– Does not promotes ENCAPSULATION and implies classes should
probably be split into two or more subclasses
– Helps to identified low-quality design

12

Anda mungkin juga menyukai