The MOOD metrics set refers to a basic structural mechanism of the OO paradigm as encapsulation (MHF and AHF), inheritance (MIF and AIF), polymorphisms (PF), message-passing (CF) and are expressed as quotients. The set includes the following metrics:
- Method Hiding Factor (MHF)
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 defined in the system under consideration. The invisibility of a method is the percentage of the total classes from which this method is not visible. A low MHF indicates insufficiently abstracted implementation. A large proportion of methods are unprotected and the probability of errors is high. A high MHF indicates very little functionality. It may also indicate that the design includes a high proportion of specialized methods that are not available for reuse. An acceptable MHF range of 8% to 25% has been suggested but we neither endorse or criticize this view.
note : inherited methods not considered.
- Attribute Hiding Factor (AHF)
AHF is defined as the ratio of the sum of the invisibilities of all attributes defined in all classes to the total number of attributes defined in the system under consideration.
- Method Inheritance Factor (MIF)
MIF is defined as the ratio of the sum of the inherited methods in all classes of the system under consideration to the total number of available methods (locally defined plus inherited) for all classes.
- Attribute Inheritance Factor (AIF)
AIF is defined as the ratio of the sum of inherited attributes in all classes of the system under consideration to the total number of available attributes
(locally defined plus inherited) for all classes.
- Polymorphism Factor (PF)
It measures the degree of method overriding in the class inheritance tree. It equals the number of actual method overrides divided by the maximum number of possible method overrides.
PF = overrides / sum for each class(new methods * descendants)
PF varies between 0% and 100%. As mentioned above, when PF=100%, all methods are overridden in all derived classes. A PF value of 0% may indicate one of the following cases:
* project uses no classes or inheritance.
* project uses no polymorphism.
* full class hierarchies have not been analyzed.
- Coupling Factor (CF)
CF is defined as the ratio of the maximum possible number of couplings in the system to the actual number of couplings not imputable to inheritance.
CF = Actual couplings/Maximum possible couplings
Thursday, November 26, 2009
Class Oriented Metrics - MOOD Metrics Suite
Posted by
Sunflower
at
11/26/2009 02:13:00 PM
0
comments
Labels: Class oriented metrics, MOOD, Object Oriented, Types
![]() | Subscribe by Email |
|
Tuesday, November 24, 2009
Metrics for Object-Oriented Design - CK Metrics Suite Cont...
- Response For Class (RFC)
The RFC is defined as the total number of methods that can be executed in response to a message to a class. This count includes all the methods available in the whole class hierarchy. If a class is capable of producing a vast number of outcomes in response to a message, it makes testing more difficult for all the possible outcomes.
- Number of Children (NOC)
It is defined as the number of immediate subclasses.
* The greater the number of children, the greater the reuse, since inheritance is a form of reuse.
* The greater the number of children, the greater is 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.
* 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.
- Coupling between object classes (CBO)
It is defined as the count of the classes to which this class is coupled. Coupling is defined as : Two classes are coupled when methods declared in one class use methods or instance variables of the other class.
* Excessive coupling between object classes is detrimental to modular design and prevents reuse. The more independent a class is, the easier it is to reuse it in another application.
* In order to improve modularity and promote encapsulation, inter-object class couples should be kept to a minimum. The larger the number of couples, the higher the sensitivity to changes in other parts of the design, and therefore maintenance is more difficult.
* A measure of coupling is useful to determine how complex the testing of various parts of a design are likely to be. The higher the inter-object class coupling, the more rigorous the testing needs to be.
- Lack of Cohesion in Methods (LCOM)
It is defined as the number of different methods within a class that reference a given instance variable.
* Cohesiveness of methods within a class is desirable, since it promotes encapsulation.
* Lack of cohesion implies classes should probably be split into two or more subclasses.
* Any measure of disparateness of methods helps identify flaws in the design of classes.
* Low cohesion increases complexity, thereby increasing the likelihood of errors during the development process.
Posted by
Sunflower
at
11/24/2009 07:23:00 PM
0
comments
Labels: Class oriented metrics, Object Oriented, Software Metrics, Types
![]() | Subscribe by Email |
|
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.
Posted by
Sunflower
at
11/24/2009 12:50:00 PM
0
comments
Labels: Class oriented metrics, Object Oriented, Software Metrics, Types
![]() | Subscribe by Email |
|