A Hierarchical Model for Object

Download Report

Transcript A Hierarchical Model for Object

A Hierarchical Model for Object-Oriented
Design Quality Assessment
by J. Bansiya and C.G. Davis
Rationale for this Research
• OO paradigm requires a reassessment of the
elements to evaluate software quality
– Encapsulation
– Inheritance
– Polymorphism
• There exists a need to have metrics and model that
can be applied to earlier phase of the project, such
as to the design, so that something can be done to
the quality of the product (not after it is coded).
Started with ISO 9126 attributes and
modified them
• 6 Quality Attributes:
–
–
–
–
–
–
–
–
1) Functionality - - kept
Reliability - - excluded (implementation oriented)
2) Efficiency- - changed to Effectiveness of design
Usability - - - excluded (implementation oriented)
3) Maintainability – changed to Understandability
4) Portability - - changed to Extendibility
5) Reusability - - added
6) Flexibility - - added
11 O.O. Design Properties & associated Metrics
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
Design Size – number of classes
Hierarchies – number of class hierarchies
Abstraction – average number of ancestors for the classes
Encapsulation – ratio of private attributes/ total attributes
Coupling – number of classes that pass messages or share
attributes
Cohesion – ratio of intersection of parameters of methods in a class
to all the parameters in the class
Composition – number of data declarations whose type is a user
defined class
Inheritance – ratio of number of methods inherited by a class to the
total number of methods accessible by the methods in the class
Polymorphism – number of methods that exhibit polymorphic
behavior
Messaging - number of public methods in a class
Complexity – number of methods defined in a class (my commenthow about attributes in the class?)
Quality Attribute .vs. Design Properties
Indexing Scheme
Quality Attributes
Reusability
Flexibility
Understandability
Functionality
Index computation using Design Properties
-.25* coupling + .25* cohesion + .5* messaging + .5* design size
.25* encapsulation -.25* coupling +.5* composition + .5* polymorphism
-.33* abstraction +.33* encapsulation -.33* coupling +.33* cohesion -.33*
polymorphism -.33* complexity -.33* design size
.12* cohesion+ .22* polymorphism +.22* messaging+.22* design size +.22*
hierarchies
.5* abstraction -.5*coupling + .5* inheritance +.5* polymorphism
Extendibility
Effectiveness
.2* abstraction + .2* encapsulation+ .2* composition+ .2* inheritance + .2*
polymorphism
Note: that the weights for the design properties adds up to 1
for each quality attribute
Performed Several Studies
• Individual Quality Attribute Validation:
– Over two sets of products
• 5 releases of MFC
• 4 releases of Borland Object Window library
– Except for Understandability all other quality attributes
increased in value (improved) from release to release.
• Computation is based on computing the metrics for all 11 design
properties for each of the releases. (table 8)
• Normalized the metric using the first release as the base (table 9)
• Computed the index for each of the 6 quality attributes for each of
the release. (table 10)
• Plotted the quality attributes’ indices for the releases (figs. 2 and 3)
– Understandability decreased because more functions are added
for each release - - - - the index bears that out. (table 10)
Evaluated the Model as a whole
• Took 14 projects
• Assigned 13 “experts’ to evaluate the 14 projects based on the
6 Quality Attributes and asked them to rank the project (table
11).
• Evaluated the 14 projects based on the 11 design properties
(table 12)
• Normalized the table 12 information (table 13)
• Computed the indices for the 6 quality attributes of each of the
14 projects (table 14)
• Ranked the 14 projects based on the indices computed for each
of the 6 quality attributes for all 14 projects (table 11 QMOOD
Ranking --- which is based on table 14).
• Performed a correlation analysis of the QMOOD ranking against
the 13 evaluators rankings.
• *** 11 of the 13 evaluators correlated well with the QMOOD
ranking. (table 15)**** (see next chart on how to get table 15)
How to get to Table 15
proj.
Eval. 1, Eval. 2 , - - - - -
Eval 13, QMOOD
d
1
12
13
1
2
9
3
4
3
13
2
4
9
12
5
1
6
8
1
5
3
0
7
8
4
3
11
9
5
10
6
11
11
12
7
13
10
14
14
1
d2
1
16
1
9
0
3
9
7
5
49
25
7
2
4
2
4
4
7
16
49
6
1
1
10
0
8
14
0
0
0
Sum of d2= 180
r = 1 – [ (6 * sum d2)/( n (n2 -1)] = 1 – (1080/2730) = 1 -.395 = .604
r >.55 , thus Evaluator 1 and QMOOD correlates
Do this for each evaluator
Conclusion
• While there is room for arguments (especially the
indexing scheme)
• This model provided a way to define
– OO Design Properties and
– their associated metrics
• This model provided a definition of quality attributes
and associated to the design properties.
• The model was tested out against several products
and projects.
• *** Need more study *** before we can claim victory!