Professional Documents
Culture Documents
To use this metric, the software engineer must repeat this process n times, where n is the number of methods for the given class. In order to complete this process, the software engineer must do the following, Compute the complexity of the method, using a specific complexity measure. Please see links for more information on complexity metrics.
In order to calculate this metric, the Software Engineer must consult their Inheritance tree.
An Example of this is as follows,
To find this, the Software Engineer must traverse the tree until the deepest child has been visited. It is then this number that should be entered. In the preceding example, the number to be entered into the cell would be 4.
Number of Children
In order to calculate this metric, the Software Engineer must consult their Inheritance Tree. An Example of this is as follows, To calculate this metric, the Software Engineer must calculate the number of children that are one level below the class under calculation. In the preceding example, the number of children for C2 is 3 (C21, C22, C23).
In order to find the coupling between object classes, the Software Engineer must consult his/her set of CRC cards.
In order to calculate responce for a class, the Software Engineer must do the following,
In order to calculate the lack of Cohesion in methods, the Software Engineer must consult their CRC index cards. They should then do the following,
Pick the first attribute. Go through the list of CRC cards and count the number of cards that access that particular attribute picked in step one.
Record this number and repeat until all attributes have been processed.
Take the greatest number and input this number into the cell.
Example of CK Metrics
For the first box enter
CK Metrics Summary
Weighted Methods Per Class (WMC): 0.77 Depth of Inheritance Tree (DIT): 5 Number of Children (NOC): 5 Coupling between Object Classes (CBO): 5
CK Metrics Suggestions
1. Your Weighted Methods Per Class Metric is high thus limiting the potential reuse of this class. Therefore, you may want to reduce the number of methods and/or their complexity
2. The Depth of Inheritance Tree is high thus increasing the design complexity.
Therefore, you may want to reduce the use of Inheritance. 3. The Number of Children for this class is high thus diluting the abstraction of the parent class and increasing the amounf of testing. Therefore, you may want to reduce the number of children. 4. The Coupling between object classes is high thus reducing the reusability of a class and complicating modifications and testing Therefore, you may want to reduce the number of collaborator class by combining similar collaborators. 5. The Response for a class is high thus increasing the testing effort, test sequence and the overall design complexity of the class Therefore, you may want to reduce the number of operations that maybe execute in response to a message recieved 6. The Lack of Cohesion in Methods is high thus increasing the complexity of class design Therefore, you may want to reduce the lack of cohesion in methods by breaking down the class into two or more seperate classes.