1 / 18

Object-Oriented Metrics

Object-Oriented Metrics. Localization Encapsulation Information hiding Inheritence Object abstraction. Characteristics of OO. Is a process of placing items in close proximity to each other - OO approaches localize information around objects which means that:

cortez
Download Presentation

Object-Oriented Metrics

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Object-Oriented Metrics

  2. Localization Encapsulation Information hiding Inheritence Object abstraction Characteristics of OO

  3. 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 localization

  4. 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, Encapsulation

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

  6. 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 Information hiding

  7. 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 Inheritence

  8. 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). - Abstraction

  9. 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 Morris's OO Metrics

  10. 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} Morris's OO Metrics

  11. 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. Morris's OO Metrics

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

  13. 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 Morris's OO Metrics

  14. 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 Morris's OO Metrics

  15. 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 Morris's OO Metrics

  16. 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. Average Method Complexity Sum of V(g) of all Methods = ----------------------------------- Total number of application Methods Morris's OO Metrics

  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

More Related