Presentation is loading. Please wait.

Presentation is loading. Please wait.

Object-Oriented Metrics

Similar presentations


Presentation on theme: "Object-Oriented Metrics"— Presentation transcript:

1 Object-Oriented Metrics

2 Characteristics of OO Localization Encapsulation Information hiding
Inheritence Object abstraction

3 localization Is a process of placing items in close proximity to each other - OO approaches localize information around objects which means that: - metrics identification and gathering effort recognize “object” as the basis unit of software - within systems of objects, the localization between functionality and objects is not one-to-one relationship. for example one function may involve several objects, and one object may provide many functions

4 Encapsulation Is the packaging (or binding together) of a collection items - in oo programming languages, encapsulating mechanisms are eg. C++'s classes, Ada's pakages, and modula 3's modules - objects encapsulate: = knowledge of state, advertised capabilities (sometimes called operations, method interfaces, method selectors, or method interfaces), methods, [in the case of composite objects] other objects, [optionally] exceptions, constants,

5 Encapsulation Impact on metrics: - the basic unit will be object
- modify thinking on characterizing and estimating systems

6 Information hiding Is the suppression (or hiding) of details
- The general idea is that we show only that information which is necessary to accomplish our immediate goals. -Information hiding plays a direct role in such metrics as object coupling and the degree of information hiding

7 Inheritence Is a mechanism whereby one object acquires characteristics from one, or more, other objects - Some object oriented languages support only single inheritance, i.e., an object may acquire characteristics directly from only one other object -Some object-oriented languages support multiple inheritance, i.e. an object may acquire characteristics directly from two, or more, different objects

8 Abstraction Is a mechanism for focusing on the important details of a concept or items, while ignoring the inessential details - In object abstraction, we treat objects as high-level entities (i.e., as black boxes). -

9 Morris's OO Metrics Method per class
From the standpoint of code reuse ... a large number of methods per object class is desirable because subclasses tend to inherit a larger number of methods from superclasses. It was seem that extensibility will suffer if the number of methods per object class gets too large. A larger number of methods per object class is likely to complicate testing due to the increased object size and complexity. Total no. of methods No. of Methods per Object Class = Total No. of Object Classes

10 Morris's OO Metrics Inheritance Denpendencies
-Inheritance tree depth is likely to be more favorable than breadth in terms of reusability via inheritance. Deeper inheritance trees would seem to promote greater method sharing than would broad trees. -A deep inheritance tree may be more difficult to test than a broad one. -Comprehensibility may also be diminished with a large number inheritance layers Inheritance Tree Depth = max{Inheritance Tree Path Length}

11 Morris's OO Metrics Degree of coupling between objects
-A higher degree of coupling between objects is likely to complicate application maintenance because object interconnections and interactions are more complex. -The higher the degree of object independence (i.e. the more 'uncoupled' objects are from each other) the more likely it is that objects will suitable for reuse within the same applications and within other applications. -Uncoupled objects should be easier to augment than those with a high degree of 'uses' dependencies, due to the lower degree of interaction. -Testability is likely to degrade with a more highly coupled system of objects. -Object interaction complexity associated with coupling can lead to increased error generation during development.

12 Morris's OO Metrics Degree of coupling between objects
Average No. of Uses Dependencies per Object Total No. of Arcs = Total No. of Objects

13 Morris's OO Metrics Degree of cohesion of objects
-Objects which are less dependent on other objects for data are likely to be more reusable. -Low cohesion is likely to produce a higher degree of errors in the development process. Low cohesion adds complexity which can translate into a reduction in application reliability. Degree of cohesion of Object Total Fain-in for all Objects = Total No. of Objects

14 Morris's OO Metrics Object Library Effectiveness
-If objects are actually being designed to be reusable beyond a single application, then the effects should appear in object library usage statistics. Average Number of object reuse Total Number of Objects Reuse = Total No. of Library Objects

15 Morris's OO Metrics Factoring Effectiveness
-the more highly factored an application is, the smaller the number of implementation locations for the average method. -The more highly factored an inheritance hierarchy is the greater degree to which method reuse is likely to occur. -Highly factored applications are likely to be more reliable for reasons similar to those which argue that such applications are more maintainable. The smaller the number of implementation locations for the average task, the less likely that errors were made during coding factoring effectiveness Number of Unique Methods = Total number of Methods

16 Morris's OO Metrics Average Method Complexity
-More complex methods are likely to be more difficult to maintain. -Greater method complexity is likely to lead to a lower degree of overall application comprehensibility. -Greater method complexity is likely to adversely affect application reliability. -More complex methods are likely to be more difficult to test. Sum of V(g) of all Methods = Total number of application Methods

17 Chidamber and Kemerer Metrics
There are many existing proposed measures developed specifically for object-oriented systems The representative work conducted by Chidamber and kemerer (1994 in IEEE Trans Software engineering) proposed 6 major metrics WMC (Weighted Methods per Class) For a class C with methods M1, M2, …, Mn, weighted respectively with complexity X1,X2,…,Xn, WMC is calculated as the sum of Xu, u = 1 ~ n DIT (Depth of Inheritance Tree) The length of the maximum path from the node to the root of the inheritance tree

18 NOC (Number of Children)
The number of immediate successors of the class CBO (Coupling Between Object Classes) the number of other classess to which the class is coupled RFC (Response for Class) the number of local methods plus the number of methods called by the local methods LCOM (Lack of Cohesion Metric) the number of disjoint (non-intersection) sets of local methods Li and Henry (1995) conducted empirical study and concluded that these metrics can predict maintenance effort


Download ppt "Object-Oriented Metrics"

Similar presentations


Ads by Google