Presentation is loading. Please wait.

Presentation is loading. Please wait.

A Validation of Object-Oriented Design Metrics As Quality Indicators Basili et al. IEEE TSE Vol. 22, No. 10, Oct. 96.

Similar presentations


Presentation on theme: "A Validation of Object-Oriented Design Metrics As Quality Indicators Basili et al. IEEE TSE Vol. 22, No. 10, Oct. 96."— Presentation transcript:

1 A Validation of Object-Oriented Design Metrics As Quality Indicators Basili et al. IEEE TSE Vol. 22, No. 10, Oct. 96

2 Abstract Suite of OOD metrics by Chidamber. Predictors of fault-prone classes? Can be used as early quality indicators? Other study: frequence of maintenance changes. 8 medium sized information management systems

3 Metric CBO: coupling between object classes: a class is coupled to another one if it uses its member functions and/or instance variables. CBO = number of classes to which a given class is coupled.

4 Connection to Law of Demeter Following LoD or reducing the number of violations reduces CBO because LoD only allows good coupling.

5 Law of Demeter: Violation class A {public: void m(); P p(); B b; }; class B {public: C c; }; class C {public: void foo(); }; class P {public: Q q(); }; class Q {public: void bar(); }; void A::m() { this.b.c.foo(); this.p().q().bar();} CBO(A) = 4 With LoD: CBO(A) = 2 CBO(A)= {B,C,P,Q}

6 Metric RFC: response for a class. This is the number of methods that can potentially be executed in response to a message received by an object of that class.

7 Connection to Law of Demeter Following LoD or reducing the number of violations reduces RFC because LoD allows fewer methods to be called.

8 Law of Demeter: Violation class A {public: void m(); P p(); B b; }; class B {public: C c; }; class C {public: X foo(); }; class P {public: Q q(); }; class Q {public: Y bar(); }; void A::m() { this.b.c.foo(); this.p().q().bar();} RFC(A) = 6 With LoD: RFC(A) = 4 RFC(A)= {b,c,p,q,foo,bar} Assume data member access through get method RFC(A)= {b,p,foo2,bar2} But …

9 Law of Demeter: Violation class A {public: void m(); P p(); B b; }; class B {public: C c; void foo2() {c.foo();}; class C {public: X foo(); }; class P {public: Q q(); void bar2(){q().bar(); }; class Q {public: Y bar(); }; void A::m() { this.b.foo2(); this.p().bar2();} RFC(A) = 4 RFC(B) = 2 RFC(P) = 2 8 With LoD: Assume data member access through get method Without LoD: 6 + 0 + 0 = 6 LoD spreads RFC but it might increase it!

10 Law of Demeter: Violation Illustrate better separation class A {public: void m(); P p(); B b; }; class B {public: C c; }; class C {public: X foo(); }; class P {public: Q q(); }; class Q {public: Y bar(); }; void A::m() { X x=M.cg.fetch(this,”from A to X”); Y y=M.cg.fetch(this,”from A to Y”);} With LoD: RFC(A) = 1 RFC(A)={fetch} Assume data member access through get method RFC(A) = 4 RFC(B) = 2 RFC(P) = 2 8 CBO(A)= {DJ.ClassGraph}

11 Class Diagram A BC b c PQ p() q() foo() bar() m X Y from A to X from A to Y

12 Hypotheses H-CBO: Highly coupled classes are more fault-prone than weakly coupled classes because they depend more heavily on methods and objects defined elsewhere. H-RFC: Classes with larger response sets implement more complex functionalities and are, therefore, more fault-prone.

13 RFC (on projects) X axis: values of metric. Y axis: number of classes. Y X Probability of fault detection increases

14 CBO (on projects) X axis: values of metric. Y axis: number of classes. Y X Probability of fault detection increases

15 Results RFC is very significant. The H-RFC hypothesis is supported. CBO is significant, particularly for UI classes.

16 Analysis Methodology Response variable: binary: was a fault detected in a class during testing? Used logistic regression, a standard technique used in experimental sciences. Alternatives would be: classification trees, optimized set reduction, or neural networks.

17 Study Participants Four months Students in a class on OO software analysis and design Control differences in skills: randomly grouped into eight teams. Used blocking: eight most experienced students randomly assigned to a different group.

18 Development Process for Video Store Application Sequential software engineering life-cycle model based on waterfall model: analysis, design, implementation, testing and repair. Requirement and design document were checked. OMT (Rumbaugh) was used C++ with MotifApp, GNU library, database library.


Download ppt "A Validation of Object-Oriented Design Metrics As Quality Indicators Basili et al. IEEE TSE Vol. 22, No. 10, Oct. 96."

Similar presentations


Ads by Google