|
|
| Shyam R. Chidamber, Chris, F. Kemerer |
| |
| << LABORATORY |
<< Object Oriented Metrics |
Chidamber |
| |
| Reference: Chidamber, S.R.; Kemerer, C.F.: A Metrics Suite for Object Oriented Design, CISR Working Paper No. 249, M.I.T. Sloan School of Management, February 1993. |
| |
"Metrics and their viewpoints: "
- Weighted Methods Per Class: as sum of the McCabe numbers
- "The number of methods and the complexity of methods involved is an indicator of how much time and effort is required to develop and maintain a 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: with the viewpoints
- "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.''
- Number of Children: as number of immediate sub-classes
- "Greater the number of children, greater the reuse, since inheritance promotes reuse.
- 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 mimuse 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 Objects: if an object acts with the other
- "Excessive coupling between objects is detrimental to modular design and prevents reuse. The more independent an object is, the easier it is to reuse it in another application.
- In order to improve modularity and promote encapsulation, inter-object 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 coupling, the more rigorous the testing needs to be.''
- Response For a Class: as number of used methods in a method
- "If a large number of methods can be invoked in response to a message, the testing and debugging of the class becomes more complicated since it requires a greater level of understanding required on the part of the tester.
- The larger the number of methods that can be invoked from a class, the greater the complexity of the class.
- A worst case value for possible responses will assist in appropriate allocation of testing time.''
- Lack of Cohesion in Methods: as set of the disjunctive instance variables
- "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 sub/classes.
- Any measure of disparanteness of methods helps identify flaws in the design of classes.
- Low cohesion increases complexity, thereby increasing the likelihood of errors during the development process.''
|
|
|
|