Tuesday, July 31, 2007

Data Slice

Example:


Source: Slice-Based Cohesion Metrics and Software

The Mood Metrics Suite

The MOOD metrics suite consists of six metrics:

1 Method Hiding Factor (MHF): The MHF is defined as the ratio of the sum of the invisibilities of all methods defined in all classes to the total number of methods in a design.

2 Attribute Hiding Factor (AHF): The AHF is defined as the ratio of the sum of the invisibilities of all attributes defined in all classes to the total number of class attributes in a design.

3 Coupling Factor (CF): The CF metric is defined as the ratio of the number of class couplings to the maximum possible number of class couplings in a design.

4 Method Inheritance Factor (MIF): The MIF metric is defined as the ratio of the number of inherited (and not overridden) methods in all classes to the total number of available methods (locally defined plus inherited) for all classes in a design.

5 Attribute Inheritance Factor (AIF): The AIF metric is defined as the ratio of the number of inherited attributes in all classes to the total number of available attributes (locally defined plus inherited) for all classes in a design.

6 Polymorphism Factor (PF): The PF metric is defined as the ratio the number of methods that redefine inherited methods to the maximum number of possible distinct polymorphic situations.

Source: Indicators of Structural Stability of Object-Oriented Designs: A Case Study

Lack of cohesion in methods

Example (Source: OMPSCI702 Software Measurement The "CK" Metrics)


The CK Metrics Suite

The metrics are proposed by Chidamber and Kemerer.

Exercise of Coupling between Object Classes (CBO)

Reference: COMPSCI702 Software Measurement The "CK" Metrics

Response for a class

When a large number of methods of a class can be invoked in response to a single message, the testing and debugging of the class becomes complicated. (Source: RFC)

Example (Source: COMPSCI702 Software Measurement The "CK" Metrics)

Exercise of Coupling between object classes (CBO)

What is the CBO?

(A) 3
(B) 4
(C) 5

Source of the picture: Identify Collaborations

Exercise of Depth of the inheritance tree

Why does some software practitioner say that a value of DIT greater than 4 will have to compromise encapsulation and increase complexity?

(Source: Depth of the inheritance three )