Subscribe by Email


Tuesday, November 24, 2009

Metrics for Object-Oriented Design - CK Metrics Suite

In Object Oriented software development process, the system is viewed as collection of objects. The functionality of the application is achieved by interaction among these objects in terms of messages. Whenever, one object depends on another object to do certain functionality, there is a relationship between those two classes. In order to achieve perfect "separation of concern", objects should rely on the interfaces and contracts offered by another object without relying on any underlying implementation details. OO Design metrics can be a very helpful measuring technique to evaluate the design stability. Also, given a correct abstraction of layers and appropriate relationship between the classes, there are still chances that the coding process might introduce a few more vulnerability. At this stage also OO metrics can be of help to identify, if we need to pay further attention to any of the code to make it more maintainable.
There are different kinds of Object Oriented Metrics :

CLASS ORIENTED METRICS - THE CK METRICS SUITE
Chidamber and Kemerer's metrics suite for OO Design is the deepest reasearch in OO metrics investigation. They have defined six metrics for the OO design.

- Weighted Methods per Class (WMC)
It is defined as the sum of the complexities of all methods of a class.
* The number of methods and the complexity of methods involved is a predictor of how much time and effort is required to develop and maintain the class.
* 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.
* Classes with large numbers of methods are likely to be more application specific, limiting the possibility of reuse.

- Depth of Inheritance Tree (DIT)
It is defined as the maximum length from the node to the root of the tree.
* The deeper a class is in the hierarchy, the greater the number of methods it is likely to inherit, making it more complex to predict its behavior.
* Deeper trees constitute greater design complexity, since more methods and classes are involved.
* The deeper a particular class is in the hierarchy, the greater the potential reuse of inherited methods.


No comments:

Facebook activity