Presentation is loading. Please wait.

Presentation is loading. Please wait.

The CK Metrics Suite. Weighted Methods Per Class b To use this metric, the software engineer must repeat this process n times, where n is the number of.

Similar presentations


Presentation on theme: "The CK Metrics Suite. Weighted Methods Per Class b To use this metric, the software engineer must repeat this process n times, where n is the number of."— Presentation transcript:

1 The CK Metrics Suite

2 Weighted Methods Per Class b 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. –Input the value into the text box. –Click the Add button. –Continue process until all methods have been completed.

3 Depth of Inheritance Tree b In order to calculate this metric, the Software Engineer must consult their Inheritance tree. b An Example of this is as follows, b 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. b In the preceding example, the number to be entered into the cell would be 4.

4 Number of Children b In order to calculate this metric, the Software Engineer must consult their Inheritance Tree. b An Example of this is as follows, b To calculate this metric, the Software Engineer must calculate the number of children that are one level below the class under calculation. b In the preceding example, the number of children for C2 is 3 (C21, C22, C23).

5 Coupling between Object Classes b In order to find the coupling between object classes, the Software Engineer must consult his/her set of CRC cards. b To find this value, the Software Engineer must do the following, –Obtain the class under calculation CRC index card. –Count the number of collaborations listed for the class. –Input this number into the cell.

6 Response for a Class b In order to calculate responce for a class, the Software Engineer must do the following, –Consult the classes CRC index card. –Take the first message and count the number of methods that can potentially be executed in response to this message –Record this number, and repeat this process for all methods. –When finished, input the greatest number into the cell.

7 Lack of Cohesion in Methods b 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.

8 Example of CK Metrics b For the first box enter 0.76, 0.76, 0.79 the hit ok after each one. b For the remaining boxes enter 5

9 CK Metrics Summary b b Weighted Methods Per Class (WMC): 0.77 b b Depth of Inheritance Tree (DIT): 5 b b Number of Children (NOC): 5 b b Coupling between Object Classes (CBO): 5 b b Response for a Class (RFC): 5 b b Lack of Cohesion in Methods (LCOM): 5

10 CK Metrics Suggestions b b 1. Your Weighted Methods Per Class Metric is high thus limiting the potential reuse of this class. b b Therefore, you may want to reduce the number of methods and/or their complexity b b 2. The Depth of Inheritance Tree is high thus increasing the design complexity. b b Therefore, you may want to reduce the use of Inheritance. b b 3. The Number of Children for this class is high thus diluting the abstraction of the parent class and increasing the amounf of testing. b b Therefore, you may want to reduce the number of children. b b 4. The Coupling between object classes is high thus reducing the reusability of a class and complicating modifications and testing b b Therefore, you may want to reduce the number of collaborator class by combining similar collaborators. b b 5. The Response for a class is high thus increasing the testing effort, test sequence and the overall design complexity of the class b b Therefore, you may want to reduce the number of operations that maybe execute in response to a message recieved b b 6. The Lack of Cohesion in Methods is high thus increasing the complexity of class design b b Therefore, you may want to reduce the lack of cohesion in methods by breaking down the class into two or more seperate classes.

11 Lorenz and Kidd Metrics Suite

12 Total Number of Operations b b In order to calculate the number of operations, the Software Engineer must do the following, – –Obtain the Classes CRC index cards. – –Count the number of operations listed for the class. – –Input this number into the cell.

13 Number of Operations Overridden by a Subclass b b If this particular class is a subclass of another parent class, it may over ride some operations of its parents class. b b To calculate this, the Software Engineer must do the following, – –Obtain the CRC index cards for both the subclass and parent class. – –Pick a particular operation and see if it is overridden in the subclass. – –If so, add one and continue on to the next operation. – –Else, proceed to the next operation – –Continue until all operations have been processed. – –Record value in cell.

14 Number of Operations Added by a Subclass b b In order to calculate the number of operations added by a subclass, the Software Engineer must do the following, – –Obtain the CRC cards for both the parent and subclass. – –Pick an operation in the subclass. – –Verify that it is in the parent class. – –If not, increment count. – –Repeat until all operations have been processed. – –Input count into cell

15 Current Class Level b b In order to calculate the current classes level, the Software Engineer must consult the Inheritance Tree b b In the following Inheritance chart, if we were evaluating C2 the level would be 1. b b Please note that the first level, class C, is 0 not 1.

16 The MOOD Metrics Suite

17 Number of Methods Inherited b b In order to determine the number of methods inherited, the Software Engineer must do the following, – –Obtain the class to be processed and parent classes CRC cards. – –Pick a method in the parent class and check to see if it is also defined in the the new class. – –If so, add one. – –Repeat until all methods have been processed. – –Enter number into cell.

18 Number of Methods b b In order to determine the number of methods, the Software Engineer must do the following, – –Obtain the current classes CRC card. – –Count the number of methods. – –Input count into cell.

19 Number of New Methods b b In order to determine the number of new methods, the Software Engineer must do the following, – –Obtain the class to be processed and parent classes CRC cards. – –Pick a method in the parent class and check to see if it is also defined in the the new class. – –If not, add one. – –Repeat until all methods have been processed. – –Enter number into cell.

20 Lorenz and Kidd Operation- Oriented Metrics Suite

21 Binder Object-Oriented Testing Metrics

22 Lack of Cohesion in Methods b b 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.

23 Number of Public Attributes b b In order to find the number of public attributes, the Software Engineer must do the following, – –Obtain the class CRC cards. – –Pick an attribute. – –Go through the class collaborators and see if any access the attribute. – –If so, increment the count. – –Repeat process until all attributes have been processed. – –Enter count into the cell.

24 Number of Private Attributes b b In order to find the number of private attributes, the Software Engineer must do the following, – –Obtain the class CRC cards. – –Pick an attribute. – –Go through the class collaborators and see if any access the attribute. – –If not, increment the count. – –Repeat process until all attributes have been processed. – –Enter count into the cell. b b * Another way to calculate the number of private attributes is as follows, b b Number of Private Attributes = Total Number of Attributes - Number of Public Attribute

25 Friend Classes b b In order to calculate the number of friend classes, the Software Engineer must do the following, – –Obtain all classes CRC cards. – –Process all classes and count the number that has the class under calculation as a collaborator. – –Enter this number into the cell.

26 Number of Root Classes b b In order to determine the number of root classes, the Software Engineer must do the following, – –Obtain the Projects Inheritance Chart. – –From the chart, count the number of distinct parent classes that all other classes are derived from. – –Enter this number into the cell.

27 Multiple Inheritance b b In order to see if a class uses multiple inheritance, the Software Engineer must do the following, – –Consult Inheritance Tree Diagram – –Calculate Fan-in for the current class? b b An Example of this is as follows, b b If the current class was r, then the fan in would be equal to 4. b b It inherits attributes and operations from classes n, o, p, and q.

28 Lorenz and Kidd Metrics Suite

29 Number of Use-Cases/Scenarios b b In order to find the number of use-cases/scenarios, the Software Engineer should do the following, – –Obtain Project Planning Document. – –Goto Use-Case Section. – –Count number of Use-Cases. – –Input number into cell.

30 Number of Key Classes


Download ppt "The CK Metrics Suite. Weighted Methods Per Class b To use this metric, the software engineer must repeat this process n times, where n is the number of."

Similar presentations


Ads by Google