SOFTWARE QUALITY METRICS
Flippy693 de Marzo de 2013
7.207 Palabras (29 Páginas)427 Visitas
page 1
SOFTWARE QUALITY METRICS
for
Object Oriented
System Environments
SATC-TR-95-1001
JUNE 1995
National Aeronautics and Space Administration
Goddard Space Flight Center, Greenbelt Maryland 20771
Software
Assurance
Technology
Center
page 2
TABLE OF CONTENTS
I. Introduction
II. Metrics Overview
III. Object-Oriented Overview
IV. Metrics for Object-Oriented Systems
A. Metric Evaluation Criteria
B. Traditional Metrics for Object-Oriented Systems
1. Methods
Metric 1: Cyclomatic Complexity
Metric 2: Lines of Code
C. Object-Oriented Specific Metrics
1. Classes
a. Methods
Metric 3: Weighted Methods per Class (WMC)
b. Messages
Metric 4: Response for a Class (RFC)
c. Cohesion
Metric 5: Lack of Cohesion of Methods (LCOM)
d. Coupling
Metric 6: Coupling Between Object Classes (CBO)
2. Inheritance
Metric 7: Depth of Inheritance Tree (DIT)
Metric 8: Number of Children (NOC)
D. Example
E. Summary
1. Metric Summary
2. COTS for Recommended Object-Oriented Metrics
V. Conclusions
Appendix A: Comprehensive Listing of Object-Oriented Metrics
Appendix B: Object-Oriented Detailed Discussion
1. Object
a. States/Attributes
b. Operations
c. Object Example
2. Class
3. Inheritance
4. Messages
5. Cohesion
6. Polymorphism
7. Object-Oriented Languages
8. Terminology
Appendix C: Cots Packages
Appendix D: Object-Oriented References
page 3
TABLES
Table 1: SATC Metrics for Object-oriented Systems
Table 2: Key Object-Oriented Definitions
Table 3: Summary of Recommended Object-Oriented Metrics
Table 4: Object-Oriented Metrics Supported by COTS
FIGURES
Figure 1: Pictorial Description of Key Object-Oriented Terms
Figure 2: Geometric Classes with Attribute, Operations and Methods
Figure 3: Pseudocode for Perimeter of an Equilateral Triangle
Figure 4: Notation of an Object
Figure 5: Sample Object
Figure 6: Conceptual View
Figure 7: Class with Objects
Figure 8: Inheritance Network
Figure 9: Message Passing
page 4
Software Quality Metrics for Object-Oriented System Environments
I. INTRODUCTION
Object-oriented analysis and design are popular concepts in today’s software development environment. They
are often heralded as the silver bullet for solving software problems,; while in reality there is no silver bullet,
object-oriented has proved its value for systems that must be maintained and modified. Object-oriented
software development requires a different approach from more traditional functional decomposition and data
flow development methods. While the functional and data analysis approaches commence by considering the
systems behavior and/or data separately; object-oriented analysis approaches the problem by looking or system
entities that combine them. Object-oriented analysis and design focuses on objects as the primary agents
involved in a computation; each class of data and related operations are collected into a single system entity.
The concepts of software metrics are well established, and many metrics relating to product quality have been
developed and used. The SATC applies a model for evaluating software quality that has four goals:
(1) Stability of Requirements and Design, (2) Product Quality, (3) Testing Effectively, and
(4) Implementation Effectively. With object-oriented analysis and design methodologies gaining popularity, it
is time to start investigating object-oriented metrics with respect to these goals. We are interested in the
answer to the following questions:
· What concepts and structures in object-oriented affect the quality of the software?
· Can traditional metrics measure the critical object-oriented structures?
· If so, are the threshold values for the metrics the same for object-oriented designs as for
functional/data designs?
· Which of the many new metrics found in literature are useful to measure the critical concepts in
object-oriented?
This report summarizes results of the SATC’s research on metrics for object-oriented systems. We start with a
brief discussion of the metrics recommended by the SATC for object-oriented systems. These metrics include
modifications of “traditional” metrics as well as “new” metrics for specific object-oriented structures. Since the
object-oriented metrics require a cursory understanding of the object-oriented concepts, Section III presents a
pictorial representation of the basic object-oriented structures and defines the key terms. A more extensive
explanation of the object-oriented structures is in Appendix B and is referenced by Section III. In Section IV,
we discuss the proposed object-oriented metrics with respect to the SATC Software Quality Model,
specifically, their relationship to the attributes of quality (Goal 2: Product Quality -Structure/Architecture,
Reuse, Maintainability). In the summary, we will address the availability of COTS packages to facilitate the
collection of these metrics. Details on the COTS packages are given in Appendix C.
II. OVERVIEW - OBJECT-ORIENTED METRICS
In this report, the SATC documents its research into the current status of object-oriented metrics. The
research was done by surveying the literature on object-oriented metrics then applying the SATC experience in
traditional software metrics to select the object-oriented metrics that support the goal of measuring design and
code quality. In addition, we required that a metric be feasible and have a clear relationship to the objectoriented
structures being measured. At this time, many proposed object-oriented metrics lack a theoretical
basis and have not yet been validated. Some of these metrics are too labor intensive to collect, or are too
dependent on the implementation technology. The object-oriented metrics proposed by the SATC can be
related to desirable software qualities.
The SATC’s approach to identifying a set of object-oriented metrics was to focus on the primary, critical
constructs of object-oriented design and to select metrics that apply to those areas. The suggested metrics are
page 5
supported by most literature and some object-oriented tools. The metrics evaluate the object-oriented concepts:
methods; classes; coupling; and inheritance. The metrics focus on internal object structure that reflects the
complexity of each individual entity and on external complexity that measures the interactions among entities.
The metrics measure computational complexity encompassing the efficiency of an algorithm and the use of
machine resources, as well as psychological complexity factors that affect the ability of a programmer to
create, modify, and comprehend software and the end user to effectively use the software.
We support the use of three traditional metrics and present six new metrics specifically for object-oriented
systems. The SATC has found that there is considerable disagreement in the field about software quality
metrics for object-oriented systems. Some researchers and practitioners contend traditional metrics are
inappropriate for object-oriented systems. There are valid reasons for applying the traditional metrics
however, if it can be done. The traditional metrics have been widely used, they are well understood by
researchers and practitioners, and their relationships to software quality attributes have been validated.
Table 1 presents an overview of the metrics proposed by the SATC for object-oriented systems. The SATC
supports the continued use of traditional metrics, but within the structures and confines of object-oriented
systems. The first three metrics in Table 1 are examples of how traditional metrics can be applied to the
object-oriented structure of methods instead of functions or procedures. The next six metrics are specifically
for object-oriented systems and the object-oriented construct applicable is indicated.
SOURCE METRIC OBJECT-ORIENTED
CONSTRUCT
Traditional CC Cyclomatic complexity Method
Traditional SIZE Lines of Code Method
Traditional COM Comment percentage Method
NEW Object-Oriented WMC Weighted methods per class Class/Method
NEW Object-Oriented RFC Response for a class Class/Message
NEW Object-Oriented LCOM Lack of cohesion of methods Class/Cohesion
NEW Object-Oriented CBO Coupling between objects Coupling
NEW Object-Oriented DIT Depth of inheritance tree Inheritance
NEW Object-Oriented NOC Number of children Inheritance
Table 1: SATC Metrics for Object-Oriented Systems
III. OVERVIEW - OBJECT-ORIENTED STRUCTURES
A brief description of the structure is given in this section using the pictorial description in Figure 1 and the
definitions in Table 2. Appendix B contains a more comprehensive discussion of object-oriented concepts
with additional diagrams of the structures. References to the detailed discussion in
...