Sie sind auf Seite 1von 5

196 IEEE JOURNAL ON SELECTED AREAS IN COMMUNICATIONS, VOL. 8. NO. 2.

FEBRUARY 1990

Statistical Quality Control Applied to Code


Inspections
DENNIS A. CHRISTENSON, STEEL T. HUANG, AND ALFRED J. LAMPEREZ

-i
Abstract-Code inspections have been used on the SESS@ Switch effort is defined as the total inspector preparation time di-
project since 1983. Beginning with a training program for all the de- vided by the number of thousand noncommentary source
velopers involved in the project, code inspections have improved with
each new SESS@Switch generic. The improvement in code inspections
lines (kncsl) in the unit of code. Preparation effort was
has been the result of hard work and innovation on the part of the found to have high positive correlation with the density
S E S P Switch software developers, and the use of some Statistical of errors found.
Quality Control (SQC) techniques. Inspection Rare: During the actual inspection meet-
Variations on a standard SQC technique, the control chart, have ing, the inspectors read the code and look for errors. The
been used to track the metrics indicative of the effectiveness of code
inspections. Parameters used in the computation of these metrics in-
inspection rate is defined as the number of noncommen-
clude the preparation effort, inspection time, number of inspectors, the tary source lines (ncsl) inspected divided by the total du-
size of the inspected unit of code, and the number of errors found at ration of the inspection meeting(s). The rate of inspection
the inspection. The exact form that these control charts have taken is not a completely independent variable. It partially de-
has evolved and improved with experience. pends upon the rate at which errors are being found, which
in turn depends upon the amount of preparation and the
INTRODUCTION density of errors present in the code. The density of dis-
covered errors was found to have an inverse relationship
C ONTROL charts have been used in industry as a
means of statistically evaluating the quality of var-
ious manufacturing processes. First, the capability of a
to the inspection rate.
Code Size: The size of the code being inspected was
found to be the major factor influencing the preparation
process and the normal statistical variations of the process
effort and the inspection rate. Larger units of code tended
are determined. From this characterization of the process,
to receive proportionately less preparation and were in-
abnormal deviations of the process and trends away from
spected at a higher rate. This resulted in a lower density
the norm can be detected and some corrective action
taken. of discovered errors for larger units of code. The small to
moderate sized units of code had high preparation effort
CODEINSPECTION FACTORS relative to the code size, and also tended to have a low
rate of inspection during the meeting. This resulted in a
In 1986, code inspection data, collected from more than
900 code inspections over several releases of SESS Switch generally higher density of discovered errors for these
units of code.
software, were analyzed. The data reported on the in-
spection form included the number of noncommentary
source lines (ncsl) of code inspected, the total time spent INSPECTION
LIMITS
by the inspectors preparing for the inspection meeting, the It was evident that inspections with low preparation ef-
length of the meeting, and the number of errors found. fort and high inspection rate yielded a low density of dis-
Several factors [2], [3] were seen in the inspections which covered errors. We needed to emphasize the importance
correlated well with the density of errors discovered: 1) of these factors to the development community. We de-
the amount of preparation effort, 2) the rate at which the fined a recommended preparation effort level, and rec-
code was inspected, and 3) the size of the unit of code. ommended inspection rate consistent with that in [ I ] . A
Preparation Effort: Prior to the actual code inspec- minimum preparation effort level was defined as half of
tion meeting, the inspectors prepare for the inspection by the recommended level, and a maximum inspection rate
studying the code and the design documents. Preparation was defined as twice the recommended rate. Three classes
of inspection were then defined in terms of these levels.
Manuscript received May 15, 1989; revised September 12. 1989. This Effective inspections would be those that met the
work was presented as a paper entitled Code inspection management using recommended preparation effort and inspection rate.
statistical control limits. by D. A. Christenson and S. T. Huang, at the
National Communications Forum, Rosemont. IL, September 28-30, 1987, Questionable inspections would be those that did
and as A code inspection model for software quality management and not meet the minimum preparation effort andlor exceeded
prediction, at the IEEE Global Telecommunications Conference & Ex- the maximum inspection rate.
hibition, Hollywood, FL, November 28-December I , 1988.
The authors are with AT&T Bell Laboratories, Naperville. IL 60566. Marginal inspections would be those that were
IEEE Log Number 8932092. between Effective and Questionable.

0733-8716/90/0200-0196$01 .OO 0 1990 IEEE


CHRISTENSON er a l . : STATISTICAL QC APPLIED TO CODE INSPECTIONS 197

Marginal inspections might have preparation effort


above the recommended, but a rate between the recom-
mended and the maximum, for example.
. .. .. . . . .. . . .
... ..... . .. . ... . . . .
ERRORLIMITS
:.................... ..... .......__
:
; ...e<
. . . . . .=. .
We characterized the process of making errors in code
as a random process, and demonstrated the variance of the
error density to be inversely proportional to the size of the
FOUND
ERROR
DENSITY
..
.
: ..

.
_... , ......,. .. ........ .
io....
. .........
...
.... . . . . . . . . . .
.. . . .
........
0

........._
.._
.-._.........
...... ...... ........................
.............
... . . . . . . . . . ...........................................
.
0.
......... ..................
-.: ......................................
+6
+5

unit of code [4].This was borne out by the variation in


.. ................................ *......................
...... ....... ............................ +,:
+4
+3

.......
+2
error densities resulting from effective inspections,
~-_-,,___,____~~- .f.. .?.
shown in Fig. 1. Superimposed on the plot is the mean
and several standard deviation units from the mean, based
.:..,.-,. .....-... ...........
...... -.................. ...................a
. ........................................ -1.
.
on the Poisson distribution. The error density distribu-
.
:
-
......... ...i .........:....
........ . . . . . ......................
0
.......... -4.
. . . . . . .......... . . . ........................... .J-
.. . . . . ..._..
4.

tions for past inspections, in each of the three inspection ... . .. .._.
classes, were characterized in terms of this simple Pois- + ,ir ., . . . .
_..-. ,.............................................. ..__.
,. ....... ,...... , ....,...-6.
.

son error model. Upper and lower limits on the density of CODE SIZE
errors were selected based on the distribution from ef-
Fig. 1. Error density versus code size for effective inspections.
fective inspections. Use of an upper limit would point
out code with a much greater than average error rate.
Using a lower limit would point out marginal inspec-
tions that may not have been effective. Such upper and
lower error limits, as a function of code size, are shown
in Fig. 2.
CODEINSPECTION IMPROVEMENT
After completing the above analysis, the inspection NUMBER OF
process was changed in several ways. The recommended ERRORS
preparation effort and inspection rate were adopted by the
project as goals. Also, a minimum preparation effort level
was adopted as entry criteria for inspections. This was set
at half of the recommended level. Also adopted was a
maximum inspection rate as exit criteria from inspections.
This was set at twice the recommended rate. These con-
trol limits and recommendations for preparation effort, in- CODE SIZE
spection rate, and error density became an integral part of (LOG-LOG PLOT)
the code inspection process. Fig. 2 . Control chart for number of errors found relative to code size.
A new set of code inspection forms was created with
accompanying instructions that included the recommen-
dations and limits. A new Meeting Notice form allowed IMPROVEMENT RESULTS
the inspection moderator to schedule a number of coor- The new set of code inspection forms and accompany-
dinated meetings for larger units of code. A new Code ing instructions were employed on the next software re-
Inspection Report form, which summarized all the rele- lease. Considerable attention was given to the inspection
vant parameters of the inspection, highlighted the prepa- results by all levels of management on the project. After
ration effort, inspection rate, and total number of errors all inspections had been held, an analysis was made of the
found relative to the code size. This form incorporated a resulting data. The preparation effofl, inspection rate, and
control chart for errors similar to that shown in Fig. 2. error density from the inspections using the new inspec-
Project-wide averages for the critical inspection parame- tion limits were compared to the set of inspections held
ters were reported at project status meetings, and were prior to the use of the limits. The results showed that there
thus brought to the attention of the project managers along was a significant improvement in the level of preparation
with other important project information. effort, and also noticeable slowing of the inspection rate,
These changes to the process encouraged each manager for larger units of code. The increased preparation and
to be aware of the preparation time being taken by the slower inspection resulted in a twofold increase in the
inspectors, of the rate at which the code was being in- density of the errors found for larger units of code.
spected, and how the resulting error density compared to
the expected range for that code size. It also allowed the AN INSPECTION MODEL
manager to exercise some judgment about the adequacy Although improvement had been made in the inspection
of the inspection, and decide on various courses of action process, the question remained whether further improve-
based on the inspection results. ment could be made. Having a model which would relate
198 IEEE JOURNAL ON SELECTED AREAS IN COMMUNICATIONS. VOL. 8. NO. 2. FEBRUARY 1990

INITIAL CODING
10 ERROR DENSIN
REMAINING CODlN (RElA TIVE):

FOUND
ERROR
DENSITY
(RELATIVE)

INSPECTION EFFORT INTENSITY


Fig. 3. New prediction chart based on inspection model

input parameters, such as the preparation effort and in- where C, is the total cost of coding errors in dollars per
spection rate, to the resulting fraction of errors found in ncsl, Ch is the time cost of the people involved, h is the
the code would be very useful. We could then estimate average code inspection effort intensity in person hours
the effectiveness of inspections. In fact, we could esti- per ncsl, w is the average number of person hours per
mate the density of coding errors remaining in the code error needed to rework inspection errors, eo is the initial
after an inspection was completed. This estimate would coding error density, A is the average cost of an error
be one of a number of factors used to estimate the quality missed by the inspection and found during later phases,
of the software. and f ( h ) is the model estimate of the fraction of errors
In 1988, using data obtained from the past software re- found in the inspection, as a function of the person hours
leases, plus the newer data from the improved inspection of inspection effort per kncsl. Fig. 4 shows a plot of this
process, we observed a very definite relationship between equation for total cost of coding errors, versus inspection
the average effort per thousand noncommentary source effort per kncsl, for several values of initial coding error
lines (kncsl) of code and the average effectiveness of in- density. Estimated cost parameters were used. This figure
spections. A model was developed that related the frac- shows that more inspection effort is justified when there
tion of initial errors found to the total hours of inspection is a higher density of errors in the code. Conversely, if
effort per kncsl, or Inspection Effort Intensity [5]. From few errors are expected, little or no effort is justified. This
this model, a chart was devised as shown in Fig. 3. Given relationship is highly dependent upon the average cost to
the inspection effort per kncsl, and the density of coding find and fix an error later in the software life cycle. More
errors found, an estimate for the remaining coding error inspection effort is justified if the later cost is high.
density could be made from the chart. For example, the
point shown in Fig. 3 represents 5 errors per kncsl found FURTHER
IMPROVEMENT
by the inspection at a particular effort intensity. The hor-
izontal sloped curves represent the initial coding error The project adopted the new prediction chart based on
density, in this case the density was 6 errors per kncsl. the inspection model (Fig. 3), replacing the older control
The vertical sloped curves represent the remaining error chart (Fig. 2) on the code inspection forms. A target for
density, in this case 1 error per kncsl. Based on the model density of errors remaining was also selected. Inspections
estimate, and other intuitional factors, one could judge having a predicted density of remaining errors above this
whether the code should be reinspected. target would be candidates for reinspection. Concep-
tually, this was a big improvement. Whereas with the
NEW INSPECTION
GUIDELINES older control chart, a moderate amount of inspection ef-
fort finding a moderate density of errors was acceptable,
One of the original questions we sought to answer
the new chart might predict a density of remaining errors
throughout the analysis of inspection data was: how
higher than the target, suggesting a reinspection of the
much inspection effort is worthwhile? The model pro-
code. With the old chart, a moderate effort finding a very
vided a means to estimate this, given we had some esti-
low density of errors implied that the code was not effec-
mate of the cost to find and fix an error in later phases of
tively inspected. Now with the new chart it might imply
development. Below is a simple equation for the total cost
that the code was very clean to begin with and few errors
of coding errors in a software release, as a function of
remained. The new chart allowed for improvement in the
inspection effort intensity:
coding process, i.e., fewer errors being made, where the
old chart was tied to the historical error density distribu-
CHRISTENSON er al.: STATISTICAL QC APPLIED TO CODE INSPECTIONS 199

AVERAGE
COST OF
CODING ERRORS
PER KNCSL

AVERAGE INSPECTION EFFORT PER KNCSL


Fig. 4. Cost of errors versus inspection effort for various initial error den-
sities

tion. It was now possible to have very clean code go 0


through an inspection with moderate effort, and be fairly
confident that the code was of high quality.
Referring to Fig 4,point D shows the estimated cost 6
of coding errors for the previous software release. The
cost equation implied that, given the expected density of FOUND
errors, and the estimated cost levels, doubling the inspec- ERROR 4
tion effort would be cost effective. The project accepted DENSITY
the challenge, and new inspection guidelines and limits (RELATIVE)
were incorporated into the inspection entry and exit cri- 2
teria.
Following these changes, the inspection data were
tracked closely. Fig. 5 illustrates the gradual increase in
0 I I I I I I
both inspection effort intensity and found error density
during the subsequent four months. These are compared INSPECTION EFFORT INTENSITY
to the levels for the previous four software releases, points (HOURS PER KNCSL)
A through D.As the figure shows, the upward trend Fig. 5 . Improvement in inspection effectiveness after new guidelines.
followed the model closely.

CHARTREFINEMENT density of remaining errors. These criteria would be eval-


uated to help determine the need for reinspection of a par-
Continuous process improvement pointed toward fur- ticular code module.
ther refining the predictive capabilities of the inspection By successfully modifying the models parameters, a
model. Project managers as well as the development com- much more accurate prediction of the number of remain-
munity voiced concern regarding the accuracy of the point ing errors, to be found by unit testing, would be available.
estimates of remaining coding error density which were The objective was to characterize the distribution of the
given for individual code inspections. The original in- ratio of the models predicted remaining error density to
spection model showed relatively good accuracy where the actual unit testing error density. The natural logarithm
the average of a large number of inspections was in- transformation of this quantity can be characterized by a
volved, such as all the inspections comprising particular probability distribution that is approximately normal, in-
features of a software release. However, predictions for dicating that the ratio itself is roughly log-normal. This is
individual inspections lacked consistent accuracy when depicted in Fig. 6. Using the mean and standard deviation
compared to results of reinspections or results of unit test- derived from this distribution, probability values could be
ing the code. easily assigned to the point estimates corresponding to the
Further analyses of the code inspection models param- inspection model curves to yield the likelihood that a given
eters and its corresponding predictions with reinspection inspection had a remaining error density (unit test error
results and unit test data provided for the development of density) at or below the selected target. This revised chart,
a refined chart which would give the probability that an which gives the probability that the density of remaining
individual inspection had fewer than a certain, targeted errors exceeds a threshold T, is shown in Fig. 7. Using
r
200 IEEE JOURNAL ON SELECTED AREAS IN COMMUNICATIONS. VOL 8. NO 2. FEBRUARY 1990

0.20 I I I I 121 F.O. Buck, Indicators of quality inspections. 1BM Tech. Rep.
TR21.802. Sys. Commun. Div., Kingston, NY, 1981.
131 A. F. Ackerman. P. J. Fowler. and R. G. Ebenau, Software inspec-
tions and the industrial production of software. in Softnure Vulidu-
tion, H. L. Hausen, Ed. New York: Elsevier Science North-Holland
0.15
1984.
[4] D. A. Christenson, and S . T. Huang, Code inspection management
> using statistical control limits. in Proc. N a t . Com!nun. F<JrUnl- 1987.
V vol. 41, no. 11, p. 1095-1100.
Z [SI -, A code inspection model for software quality management and
W 0.10
r prediction. in Proc. IEEE Global Telecotnmun. Conf. - 1988, vol. 1 ,
i$
W
pp. 468-472.
[6] M. E. Fagan, Advances in software inspections. IEEE Trcins. Sofi-
ware Eng., vol. SE-12. July 1986.
K
LL 0.05

0.0 Dennis A. Christenson received the B.S.E.E. de-


gree in 1965 from Iowa State University. the
0.01 0.05 0.5 1 5 10 50
M.S.E.E. degree in 1966 from the University of
Illinois, and the M.B.A. degree in 1973 from the
R A T I O OF P R E D I C T E D T O ACTUAL University of Chicago.
He joined AT&T Bell Laboratories in 1965.
(Log Scale) and his subsequent experience has been related to
Fig. 6. Distribution of the ratio of predicted remaining errors to actual various aspects of software development for
errors found in unit testing. switching systems. Since 1983 he has worked in
the area of Software Metrics and Software Relia-
bility in conjunction with the development of soft-
ware for the 5ESS@ Switching System. He is a member of Technical Staff
in the Quality Engineering Group of the Switching Systems Performance
Division at AT&T Bell Laboratories in Naperville. IL.

Steel T. Huang received the B.S. degree in math-


FOUND ematics in 1969 from the National Taiwan Uni-
ERROR versity and the Ph.D. degree in statistics in 1975
from the University of North Carolina at Chapel
DENSITY Hill.
He was a Faculty member at the University of
Cincinnati and University of North Carolina from
1975 to 1979. Hejoined Bell Laboratories in 1979.
He is responsible for the planning, definition. and
analysis of software quality and productivity met-
rics for the 5ESS Switch development project.
He is Supervisor of tl. Quality Engineering Group of the Switching Sys-
tems Performance Di, ;ion at AT&T Bell Laboratories in Naperville, IL.

INSPECTION EFFORT INTENSITY


Fig. 7. Revised inspection chart showing probability of remaining error
density exceeding a threshold.
Alfred J. Lamperea received the B.S. degree in
statistics from the University of Southwestern
this new chart, rather than estimating the exact density of Louisiana.
He joined AT&T in 1988 and has been respon-
remaining errors, software developers can assess the risk sible for applying statistical analysis and model-
of having too many undetected errors. ing as well as quality control techniques t o data
and metrics from various stages of the software
REFERENCES development cycle. He is a member of Technical
Staff in the Quality Engineering Group of the
i 8
[ I ] M. E. Fagan, Design and code inspections to reduce errors in pro- Switching Systems Perforniance Division at
gram development. IBM Sysr. J . . vol. 15, no. 3, 1976. AT&T Bell Laboratories in Naperville, 1L.

Das könnte Ihnen auch gefallen