IEICE TRANS. INF. & SYST., VOL.E89–D, NO.4 APRIL 2006

1347

PAPER

Special Section on Knowledge-Based Software Engineering

A Model for Detecting Cost-Prone Classes Based on
Mahalanobis-Taguchi Method
Hirohisa AMAN†a) , Member, Naomi MOCHIDUKI†∗ , Nonmember, and Hiroyuki YAMADA† , Member

SUMMARY In software development, comprehensive software reviews and testings are important activities to preserve high quality and tocontrol maintenance cost. However it would be actually diﬃcult to perform comprehensive software reviews and testings because of a lot of components, a lack of manpower and other realistic restrictions. To improve
performances of reviews and testings in object-oriented software, this paper proposes a novel model for detecting cost-prone classes; the model isbased on Mahalanobis-Taguchi method——an extended statistical discriminant method merging with a pattern recognition approach. Experimental
results using a lot of Java software are provided to statistically demonstratethat the proposed model has a high ability for detecting cost-prone classes.
key words: metrics, cost-proneness, prediction, discriminant analysis,
Mahalanobis-Taguchi method

1. Introduction
Comprehensive software reviews and testings are important
activities to preserve high quality of software products andto control maintenance cost in software development [1]–[3]. In actual software development, however, it would
be diﬃcult to achieve comprehensive software reviews andtestings because of a lot of components, a large size, a complex design, too short development duration, a lack of manpower, and other realistic restrictions. It results in an increased maintenance cost to ensure an acceptable quality
level in a software product. There have been proposed somemodels and metrics for predicting maintenance cost andcost-related attributes in software development projects [4]–[7], such as maintenance time and manpower requirements.
These models and metrics are practical but not ultimate solutions since they are not approaches to obviate rising maintenance cost.
A more eﬀective solution to control maintenance costin software projects is to detect cost-prone components(which would require higher cost than others in their maintenance activities) and/or fault-prone components (which
would include one or more faults), and perform careful reviews and testings for such cost/fault-prone components.
There have been studied some prediction models basedon linear or nonlinear regression analysis: linear regression models for predicting lines of codes (LOC) to be
Manuscript received June 29, 2005.
Manuscript revised October 6, 2005.
†
The authors are with the Faculty of Engineering, Ehime University, Matsuyama-shi, 790–8577 Japan.
∗
Presently, with the FUJITSU Broad Solution & Consulting,Inc.
a) E-mail: aman@cs.ehime-u.ac.jp
DOI: 10.1093/ietisy/e89–d.4.1347

changed in an object class through a version-upgrade using some object-oriented software metrics [8]–[10], a logistic regression model and a multivariate adaptive regression splines (MARS) model for evaluating a fault-pronenessof class [11], [12], etc. While the regression model approach is an eﬀective prediction method, it will be diﬃcult to fit various software attributes with the regression
line (or curve), especially outliers have harmful eﬀects on
the model construction, so that pattern recognition methods (e.g. Bayesian classifier) [13] and statistical classification methods (e.g. discriminant analysis) [14]–[17] would
be promising approaches to predict cost/fault-prone classes.
This paper proposes a novel model for predictively detecting cost-prone classes in object-oriented software, basedon Mahalanobis-Taguchi (MT) method [18] that is an extended statistical discriminant method merging with a pattern recognition approach.
This paper is organized as follows: Section 2 discusses
the theory of MT method along with brief descriptions of theexisting discriminant analysis methods. Section 3 proposesa novel discriminant model for detecting cost-prone classes,
based on MT method. Section 4 presents empirical studies using actual data collected from three large open-source
software projects——Eclipse, Azureus, and jEdit. Section 5
draws our conclusion and future work.
2. Mahalanobis-Taguchi (MT) Method
An object class is a basic component in object-oriented
software quality control. The contribution of this paper
is to develop an eﬀective model for predictively detectingclasses whose maintenance activities would require higher
cost than others; such classes are hereinafter called “costprone” classes. The model to be developed in this paper
will discriminate cost-prone classes from the others using
some software metrics, i.e. quantified software characteristics. This section presents brief discussions about some statistical methods underlying our discriminant model, and the
key method, Mahalanobis-Taguchi (MT) method.
2.1 Discriminant Analysis Method
Consider an entity which has some observable properties.
The entity can be expressed as a vector whose elements describe the observable properties, and then the entity vector
can be plotted on a scatter diagram. Now let our entities be
fallen into several groups. Discriminant analysis [15], [16]c 2006 The Institute of Electronics, Information and Communication Engineers
Copyright IEICE TRANS. INF. & SYST., VOL.E89–D, NO.4 APRIL 2006

1348

is a basic statistical method for drawing boundaries between
those groups on the scatter diagram. For the sake of convenience, the remains of this section will discuss the case that
we have two entity-groups in a two-dimensional space.
A simple method for separating two groups is the perpendicular bisector between the mean points of two groups.
Figure 1 shows two entity-groups A and B, and the perpendicular bisector between their mean points: the entities ofgroup A and B are marked by circles (“◦”) and crosses (“×”),respectively; the mean points of group A and B are denotedby x A and xB , respectively. In Fig. 1, however, three entities of group B (×’s) are fallen into group A side. In order
to avoid such inappropriate separation, we should take into
account the dispersion of data as well.
The separation discussed above is based on Euclidean
distances from the mean points of groups. We can introduce
another distance with consideration for dispersion of data:
Mahalanobis distance [15], [16]. For each entity group, Mahalanobis distance can be a group-specific distance that isbased on the dispersion of data in the group. Mahalanobis
distance is useful for describing a closeness of entity to agroup on the scatter diagram, and the distance has been applied to the discriminant analysis as a common method for
determining the closest group of entities. See Appendix A
for the details of Mahalanobis distance.
For an entity vector x, let D(A) (x) be Mahalanobis distance between x and x A ; similarly, let D(B) (x) be Mahalanobis distance from x B . The locus of the following equation has been a boundary between the two groups:

same dispersions (i.e. the same or approximately the same
variance-covariance matrices), the perpendicular bisector isa useful boundary between two groups; otherwise, Mahalanobis distance-based boundary would be a better boundary between groups. Needless to say, we can not make aclear separation for the two groups that overlaps with eachother on the scatter diagram, even if we use the Mahalanobis
distance-based boundary.
However not all pairs of non-overlapped groups
are properly separated using Mahalanobis distance-based
boundary. Figure 3 shows an example of such a case that
the Mahalanobis distance-based boundary could not separate two groups A (◦’s) and B (×’s). In Fig. 3, the two groups
are not overlapped; group B gathers in a ring around group
A. x A and x B , the mean points of group A and B, stay in close
to each other. Because of the closeness between x A and x B ,no boundaries drawn between x A and xB can separate thetwo groups properly in Fig. 3. Mahalanobis distance-based|D(A) (x)|2 = |D(B) (x)|2 .
Figure 2 shows an example of the boundary based on Mahalanobis distance.
The perpendicular bisector such as shown in Fig. 1 isa particular case of Mahalanobis distance-based boundary,in which the two entity-groups have the same dispersion.
If two entity-groups have the same or approximately theFig. 1

Perpendicular bisector between two groups.

Fig. 2

Fig. 3Mahalanobis distance-based boundary.

A case that the mean points of two groups are close.

AMAN et al.: A MODEL FOR DETECTING COST-PRONE CLASSES BASED ON MAHALANOBIS-TAGUCHI METHOD

1349

boundary would fail to discriminate data in such cases thatthe mean points of groups stay in close each other.
N. Mochiduki et al. [17] have applied the above Mahalanobis distance-based discriminant analysis to an objectoriented software maintainability prediction. In their empirical work, 927 version-upgrade cases of object classes
written in Java were collected from some open-source
software development sites, and the older classes of theversion-upgrade cases were measured by the following
five metrics [19], [20]: (1) Stmts, the number of executable/declaration statements; (2) NCM, the number ofclass methods; (3) NMA, the number of new methods neither inherited nor overriding; (4) NMO, the number of methods overriding that of an ancestor class; (5) PIM, the numberof public instance method. Those object classes are plotted
into a five-dimensional space using their metric values; thefive-dimensional space corresponds to a scatter diagram discussed previously. The LOC modified in version-upgrade(see Appendix B) is also counted for each version-upgradecase. Then the largest 5% cases of modified LOC were considered to be high-cost cases, and their older classes wereregarded as high-cost classes. N. Mochiduki et al. have tried
to separate those high-cost classes from the others using
Mahalanobis distance-based boundary in the space whereclasses are plotted using the above metrics. Their empirical results showed that the Mahalanobis distance-based discriminant model were only modestly beneficial because of acloseness between the mean points of two groups (high-costclasses and others) as the issue discussed previously.
We carried out a check experiment for the empirical
work performed by N. Mochiduki et al. using the same
metrics suite. Table 1 shows a summary of our empirical
data measured for jEdit [27] version 4.0; jEdit is an opensource text editor written in Java, and that has been usedin Mochiduki’s experiment as a part of empirical data. According to their definition of “high-cost” class, we considered high-cost classes to be ones whose modified LOC wereof the largest 5% in the version-upgrade “ver.4.0 → 4.1.” In
Table 1, µ{1,2} and σ1 denote the means and the standard deviations of the metric values, respectively. We could confirm
the issue that the mean points of the two groups stay in close,
since we can see µ2 ∈ [µ1 − σ1 , µ1 + σ1 ], i.e. the distance
between the mean points of groups is less than the standard
deviation of the high-cost classes for each metric. Therefore
the existing discriminant analysis methods discussed above(see Figs. 1 and 2) will not be useful in discriminating highcost classes and the others for that software. Notice thatthe above discussion does not mean the distribution of metric value is similar to Fig. 3. Figure 3 is an example to explain that the existing discriminant analysis methods could

Table 1

not separate data properly when the mean points of groups
stay in close each other.
The issue on a closeness between the mean points of
two groups leads us to require more powerful and flexible
discriminant method.
2.2 Mahalanobis-Taguchi (MT) Method
We now introduce another Mahalanobis distance-based
method applicable to the above problematic case that themean points of two groups are close to each other: themethod is called Mahalanobis-Taguchi (MT) method [18].
MT method evaluates a closeness of an entity to particular entity-group using Mahalanobis distance. For example,
let us consider a product quality control. Using some observable properties of product, we try to detect low quality
products in a set of products unexamined. We get started
by collecting some products that have good standard quality, and express them as the vectors of observable properties. The set of vectors corresponds to a group of standard
products. Then, for a product unexamined, we calculate theMahalanobis distance from the standard product group (seeAppendix A for the calculation). The Mahalanobis distancedescribes a lack of closeness of the product to the standard
product group† . In other words, the greater distance fromthe standard product group express the less quality of the
product. In the field of quality engineering, MT method
is often used as a useful method for discriminating productquality as discussed above.
We briefly mention the diﬀerence between the discriminant analysis described in Sect. 2.1 and MT method. The
goal of discriminant analysis is to draw a boundary between
entity-groups in a scatter diagram. MT method, however, isa method for quantifying a closeness of entity to particular
entity-group. In that sense, MT method seems to be a pattern recognition method rather than discriminant method. It
is fundamentally diﬀerent that MT method does not draw
any boundaries “between the mean points” of entity-groups.
MT method can properly discriminate entities even in
the above problematic case that the mean points of entitygroups are close to each other in the scatter diagram (e.g.
Fig. 3). In the case of Fig. 3, we can consider group A to
be a standard entity-group discussed above, and regard theentities of group B as unexamined ones. Then we can evaluate closenesses of those unexamined entities (group B) to
the standard entity-group (group A), using Mahalanobis distance. It is likely that an entity of group B has a larger Mahalanobis distance than the entities of group A, and the entities
of group B are properly judged as the ones “other than groupA” by MT method; we will show the numerical example inSect. 3 (see Table 2).

Empirical data measured for jEdit ver.4.0.

group

µ, σ

Stmts

NCM

NMA

NMO

PIM

high-costclassesothersµ1
σ1µ21267.141239.46106.79

17.14
39.65
2.97

72.71
77.33
5.75

2.14
2.73
1.42

185.00
194.01160.78†More precisely, the vectors of standard product group have to
be normalized such that the mean of Mahalanobis distance within
the group is equal to one.

IEICE TRANS. INF. & SYST., VOL.E89–D, NO.4 APRIL 2006

1350
Table 2 Coordinate data and Mahalanobis distances of group A and B
shown in Fig. 3.
Group AGroup Bi

xTi

D(xi )jxTj

D(x j )

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25

(2.99, 4.00)(1.77, 3.80)(2.62, 4.02)(2.15, 4.34)(1.94, 4.28)(2.25, 2.00)(3.20, 3.75)(3.15, 2.20)(3.30, 3.35)(3.38, 3.50)(1.60, 4.00)(2.60, 2.09)(2.00, 2.00)(1.67, 3.20)(3.00, 2.16)(1.67, 2.67)(1.80, 2.20)(3.43, 2.67)(1.58, 3.00)(2.33, 4.09)(1.50, 3.50)(1.60, 2.60)(2.10, 4.10)(1.74, 4.10)(1.40, 3.10)

1.05
0.69
0.81
0.97
0.95
1.08
1.11
1.23
1.09
1.21
0.93
1.02
1.13
0.63
1.16
0.83
1.06
1.27
0.77
0.76
0.82
0.93
0.77
0.90
0.93

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25

(2.18, 5.58)(1.36, 1.45)(1.42, 5.03)(2.64, 5.15)(0.87, 3.72)(3.89, 1.71)(2.74, 0.76)(3.48, 0.87)(3.16, 1.10)(3.03, 5.42)(0.86, 2.30)(4.60, 2.35)(0.90, 1.53)(4.26, 4.21)(4.48, 3.66)(1.91, 1.24)(4.34, 2.74)(3.53, 4.94)(4.29, 2.02)(0.95, 4.60)(0.71, 3.22)(4.19, 3.17)(2.44, 1.13)(3.79, 1.17)(4.12, 2.53)

2.05
1.89
1.74
1.75
1.50
2.06
2.17
2.33
2.01
2.14
1.75
2.50
2.15
2.32
2.38
1.81
2.18
2.08
2.23
1.75
1.64
2.01
1.83
2.30
1.98

3. Discriminant Model Based on MT Method
We now apply MT method to object-oriented software quality control. Our goal is to predictively discriminate costprone classes from the others using some metrics. The following is the algorithm for constructing our discriminantmodel.
Algorithm 1 (Discriminant model construction):
Entities to be examined are object classes, and observablequality-properties of those classes are measured by p metrics, m j (for j = 1, . . . , p); to avoid the potential for multicollinearity, no pairs of the metrics should have a middle orstrong correlation in their measurements. We consider thatall pairs of metrics used in the following algorithm musthave correlation coeﬃcients less than 0.4 and grater than−0.4, i.e. their absolute values are less than 0.4 [22].
I. Determination of calculation parameters(i) Collect n sample classes, ci (for i = 1, . . . , n), toform a standard class set in which each class has agood standard quality in terms of maintenance cost.
MT method empirically requires that the numberof samples is grater than three-times the number of
metrics, i.e. n > 3p.
(ii) Measure sample class ci using metric m j (for i =1, . . . , n; j = 1, . . . , p); let xi j be the metric value.
The vector of metric values, xi = (xi1 , . . . , xip )T ,expresses observable quality-properties of ci . The

vector is hereinafter called “metric vector.”(iii) For each metric m j , calculate the mean of metricvalues, x j , and the standard deviation, σ j .
(iv) Normalize xi = (xi1 , . . . , xip )T with x j and σ j :
xip − x p T
xi1 − x1
zi =, ...,,σ1σpand compute the correlation matrix R with respect
to the p metrics in {zi }. Notice that the mean pointof metric vectors is in the origin of coordinates
when we use the above normalized vectors.
II. Definition of Mahalanobis distance function
For any class whose metric vector is x = (x1 , . . . , x p )T ,the following equation gives the Mahalanobis distance† from the mean point of standard class set, D(x):zT R−1 z,(1)D(x) =pwhere

xp − xp
x1 − x1z=, ...,σ1σp

T.

In order to evaluate a uniformity of the standard classset, compute the standard deviation of D(xi )’s, σD .
(The mean of them is expected to be 1 since Eq. (1)uses a normalized vector z and a normalizing factor
1/p.) MT method requires that the standard class set
has a high uniformity in terms of metric values; hence,
remove the class ci from the standard class set whenD(xi ) > 1 + 2σD . (“1” is the mean of D(xi )’s.) If one
or more classes are removed from the standard set, goback to I-(ii). Notice that we should keep n > 3p; if theabove removal operation makes n ≤ 3p, halt the performance of algorithm, and review another samples.
III. Formulation of discriminant rule
Given a class c unexamined, whose metric vector isx = (x1 , . . . , x p )T . Let τ be a threshold value of
Mahalanobis distance for discriminating classes. If
D(x) ≥ τ, we consider that c will be other than thestandard class, i.e. c is a cost-prone class; otherwise,
we consider that c will have an acceptable quality interms of maintenance cost.
While the decision of τ depends on circumstances ofanalysis, we propose an algorithm for deciding τ later.
(see Algorithm 2)
We can apply the above algorithm to the case of Fig. 3
as follows: Consider the data shown in Fig. 3 to be twodimensional metric vector observed in classes; Fig. 3 describes 50 classes where the groups A and B have 25 classes,
respectively.
†
Equation (1) uses the correlation matrix instead of variancecovariance matrix (see Appendix A) since the vectors are normalized in the computation.

AMAN et al.: A MODEL FOR DETECTING COST-PRONE CLASSES BASED ON MAHALANOBIS-TAGUCHI METHOD

1351

I-(i). Consider group A to be the standard class set, and regard each data of group A as class ci (for i = 1, . . . , 25).
I-(ii). For each ci , consider the coordinate data in Fig. 3 tobe the elements of metric vector xi = (xi1 , xi2 )T . Table 2 shows the elements of these vectors.
I-(iii). The means and the standard deviations of metricvalues are x1 = 2.27, x2 = 3.23, σ1 = 0.677 andσ2 = 0.812.
I-(iv). The correlation matrix in the normalized vectors {zi }
is


1.00
−0.0859R=.
−0.0859
1.00

Algorithm 2 (Decision of threshold value τ):Given an object-oriented software, including k classes, tobe analyzed with the above discriminant model. Let {Di }ki=1
be the sequence of Mahalanobis distances computed for the

II. For any class whose metric vector is x = (x1 , x2 )T , theMahalanobis distance from the mean point of standard
class set, D(x), is given by Eq. (1). Table 2 shows D(xi )(for i = 1, . . . , 25). The standard deviation of Mahalanobis distances σD is expressed as σD = 0.175.
Then no classes have Mahalanobis distances grater
than 1 + 2σD = 1.35.
III. Suppose τ = 1 + 3σD = 1.52, and examine the classesof group B with τ. Table 2 shows the Mahalanobis distances computed for group B, D(x j ) (for j = 1, . . . , 25).
Using τ = 1.52 we can discriminate 24 classes (96%)
of group B from group A properly. Needless to say,all (25) classes of group A have Mahalanobis distancesless than τ, so that the model separates 49 classes(98%) properly. The model proposed has a high ability
for discriminating entities even in the above problematic case shown in Fig. 3.
Notice that Fig. 3 is an example in which the existing
discriminant analysis methods (discussed in Sect. 2.1)
could not separate data properly. This example says
MT method would be a better and promising discriminant method than the existing ones, but not MT method
is intended to be used for only the case of Fig. 3.
While the above calculation has used “1 + 3σD ” as thethreshold value τ, it has been one example among many
available threshold values. “1 + 3σD ” seems to be a reasonable threshold since the standard class set (group A) consistsof the classes whose Mahalanobis distances are less than orequal to “1 + 2σD .” However we could not find a soundground to believe that the gap between “2σD ” and “3σD ” issuﬃcient for discriminating the cost-prone classes from theothers. To decide an objective and valid threshold value forpredicting cost-prone classes, we now propose a decision algorithm using version-upgrade data in object-oriented software.

Table 3

Contingency table for classes.

typical high-cost classes
others

D(x)
<τ ≥τ
e1
s1
s2
e2

total
k1
k2

Fig. 4

Flowcharts of model operation and construction.

IEICE TRANS. INF. & SYST., VOL.E89–D, NO.4 APRIL 2006

1352

k classes (see Algorithm 1). Now categorize the k classes
into the two groups (1) “typical” high-cost classes, and (2)the others, with a particular guideline (e.g. “whether a class
has hundreds of LOC modified in the version-upgrade ornot”). For any threshold value τ, the k classes are classified
into four categories as the contingency table [23] shown in
Table 3, where k1 + k2 = k.
Define τ = Di such that ∀ j [ε(Di ) ≤ ε(D j )], i.e. ε(τ)
has the least value when τ = Di , where ε(·) is the sum oferror rates given by the following equation † :e1e2ε(τ) =
+
.
(2)
k1
k2
If ∀ j [ε(Di ) ≤ ε(D j )] holds for two or more Di ’s, adopt theleast Di as τ.

Algorithm 2 is based on the idea that the best threshold value τ has the least error in the discrimination of data.
That is a pattern recognition algorithm separating “high-costclass” patterns from the others, and the decision of threshold value corresponds to a pattern learning. The algorithm
uses only “typical” high-cost class patterns since a varietyof patterns would provide a noise to the pattern learning.
In this section, we have proposed a discriminant model
for predicting cost-prone classes. Figure 4 summarizes themodel construction flow and the operation flow.
The related work includes some regression models forpredicting maintenance costs, LOC to be changed in a classthrough a version-upgrade, using some object-oriented software metrics [8]–[10]. While the regression model approachis an eﬀective prediction method, outliers have harmful effects on the model construction, and would make a restrictive prediction model. Our model focuses on predictively discriminating cost-prone classes, rather than estimating maintenance costs of classes with a regression equation.
Our model overcomes a failing of the existing statistical discriminant methods (see Sect. 2), and has also a robustness
against outliers in the model construction since the model
adopts a pattern recognition approach.

constructed our models with Algorithms 1 and 2. Then we
performed statistical tests to demonstrate an eﬀectiveness ofthe proposed model.
4.1 Eclipse
Eclipse [24] is a universal tool platform, and a well-known
and widely used open-source object-oriented software.
We collected 2, 593 classes from the “jdt.core” component in Eclipse version 2.0, 2.1, and 3.0. This empirical study tries to predictively detect cost-prone classes in
Eclipse ver.2.1, using• the metric data collected from the classes in ver.2.0,
and• the version-upgrade data in ver.2.0 → 2.1.
The cost-proneness of a class in ver.2.1 is evaluated using
the version-upgrade data in ver.2.1 → 3.0.
Now we perform our empirical study on Eclipse as follows: (see also Fig. 5)
1. [Measurement of LOC modified in version-upgrade]:
Count LOC modified through the version-upgrades“ver.2.0 → 2.1” and “ver.2.1 → 3.0.”
2. [Metric data collection in Eclipse ver.2.0]:
Measure software quality attributes of classes in
Eclipse ver.2.0 using the metrics described later.
3. [Model construction]:
Construct our discriminant model using• the metric data measured in ver.2.0, and• the modified LOC in ver.2.0 → 2.1.
(see Algorithm 1)
Decide our threshold value τ using the modified LOC
in ver.2.0 → 2.1. (see Algorithm 2)

4. Empirical Study
This section provides empirical validations of the discriminant model proposed in Sect. 2.
The following empirical studies focus on versionupgrades in object-oriented software. We consider LOC
modified in a version-upgrade of a class to be a basic measure of maintenance cost that went into the class [8], [9],[14]. The more modified LOC corresponds to the higher
maintenance cost. A modified LOC is composed of added
LOC, removed LOC, and changed LOC, where commentstatements and empty (only white space(s)) lines are excluded. See Appendix B for the details.
The goal of the proposed model is to discriminate“cost-prone” classes from the others; cost-prone classes
would have more modified LOC than the other classes infurther version-upgrades. We collected 5, 760 classes written in Java from three open-source software projects, andFig. 5

Data flow in empirical study of Eclipse.

†
In Table 3, e1 and e2 correspond to the numbers of classes
failed in the discrimination with τ. Equation (2) uses normalized
impact level of the errors e1 and e2 .

AMAN et al.: A MODEL FOR DETECTING COST-PRONE CLASSES BASED ON MAHALANOBIS-TAGUCHI METHOD

1353

4. [Prediction of cost-prone classes in Eclipse ver.2.1]:
Measure software quality attributes of classes in
Eclipse ver.2.1 using the metrics, and predict costprone classes in the next version-upgrade 2.1 → 3.0
using the metric data and the constructed model.
5. [Statistical test]:
Perform a statistical test to validate whether the classes
predicted as cost-prone have actually more modified
LOC than the others in the version-upgrade ver.2.1 →
3.0.

4.1.1 Measurement of LOC Modified in Version-Upgrade
We measured LOC modified in the version-upgradesver.2.0 → 2.1 and ver.2.1 → 3.0. Table 4 and Fig. 6 showsa summary of statistics concerning the modified LOC.
4.1.2 Metric Data Collection in Eclipse Ver.2.0
To collect metric data of Java classes, we developed a suiteof metric collection tools. Table 5 shows the 16 metrics thatare available in our tool suite. See the literatures [19]–[21]for more details of these metrics.
Using our tool suite, we performed metric data collection for the 596 classes included in Eclipse ver.2.0. We omit
the list of their metric data for lack of space.
4.1.3 Model Construction
Construct our discriminant model according to Algorithms
1 and 2, using the modified LOC in ver.2.0 → 2.1 (that arecounted in Sect. 4.1.1) and the metric data of ver.2.0 (thatare collected in Sect. 4.1.2).
Now we have 16-dimensional metric vectors in which
Table 4

Statistics of modified LOC in Eclipse version-upgrades.

number of data
883

Fig. 6

mean (µ)
91.9

standard deviation (σ)
235

Histogram of modified LOC in Eclipse version-upgrades.

each element corresponds to each metric shown in Table 5.
In order to avoid the potential for multicollinearity in Mahalanobis distance computations, we have to use only the metrics that have high independency in their measurements. In
this empirical work, the following five metrics are selected
as our independent metrics since the other 11 metrics had
middle or strong correlations (absolute value of their correlation coeﬃcients are grater than or equal to 0.4 [22]) with
one of the five metrics:• DIT: the depth of a class in the inheritance tree. The
deeper (the higher depth level) classes would be more
likely to be overridden their methods and/or to be appended new methods. DIT value is related to a testability of the class.
• NAI: the number of attribute in a class. The more NAI
value means that the class has more information to be
managed, and the class has more roles. The less NAI
value would indicate the higher reusability of the class.
• NCM: the number of class methods in a class. NCM
denotes how many operations are common in the all
instances of the class. It is a rare case that a class has
many class methods, so that the larger NCM value may
mean a poor class design.
• NCV: the number of class variables in a class. This is
the number of variables shared in the all instances of
the class. As in the case of NCM, it is a rare design tohave many class variables, and the larger NCV value
may indicate a poor class design.
• NM: the total number of methods in a class. NM shows
how many operations can be performed in the class.
This is a basic measure concerning the size and func-

Table 5 Metrics used in data collections.
description
depth of inheritance tree; the depth level of the classin the class inheritance tree.
NAI
number of attributes in the class.
(excluding inherited ones)
NCM
number of class methods in the class.
NCV
number of class variables in the class.
NIM
number of instance method in the class.
NIV
number of instance variables in the class.
NMnumber of all methods in the class.
NMA
number of methods newly added in the class.
(not inherited, and not overridden)
NMI
number of methods inherited from the ancestors andnot overridden in the class.
NMO
number of methods overridden in the class.
NMNpubnumber of non-public methods implemented in
the class.
NMpub
number of public methods implemented in the class.
NumParanumber of parameters; the sum of number of methodparameters implemented in the class.
PIM
number of public instance methods implemented in
the class.
SIX
specialization index; the metric value is computed as
NMO × DIT / (NMO + NMA + NMI).
Stmts
number of executable/declaration statements in theclass.
metricDITIEICE TRANS. INF. & SYST., VOL.E89–D, NO.4 APRIL 2006

1354

tion points of the class. The more NM value denotesthat the class would have more eﬀorts of design, implementation, and maintenance for the class.
The selected five metrics seem to be a reasonable measuresuite for predicting cost-prone classes, since these metrics
are concerning a class testability, class design, and development eﬀorts.
In Algorithm 1-I-(i), we determine n sample classes toform a standard class set in which the classes have goodstandard quality. In the context of this empirical work,
those n sample classes should have low modified LOC in
the version-upgrade. The distribution of modified LOC isremarkably concentrated in lower values (see Fig. 6), and
it is diﬃcult to statistically determine lower outliers using
the mean (µ) and standard deviation (σ) since the frequently
used criteria, such as µ − σ and µ − 2σ, make no sense inthis case (they have negative values; see Table 4). We now
empirically define a standard class set such that a class ofthe standard set has a modified LOC less than 10. Then we
obtain the standard class set containing 203 classes.
In Algorithm 1-I-(ii),(iii) and -II, we got the Mahalanobis distances D(xi ) (for i = 1, . . . , 203) and the standard
deviation σD = 0.685. Then we found six classes whose
Mahalanobis distances are grater than 1 + 2σD = 2.37, andremoved those six classes from the standard class set. We
iterated Algorithm 1-I-(ii),(iii) and -II, until all classes’ Mahalanobis distances are less than or equal to 1 + 2σD . After
16 iterations, we got a sophisticated class set composing 135
classes.
In Algorithm 2, we determine the threshold value τ.
Now we have to define “typical” high-cost classes with aparticular guideline; in the context of this empirical work,
we have to determine “typical” large modified LOC in theversion-upgrade. We consider higher outliers in the distribution of modified LOC to be those typical large ones, anduse the guideline that typical large modified LOC is grater
than µ + 2σ. We selected 8 classes whose modified LOC aregrater than µ + 2σ = 561.9 (see Table 4) as typical high-costclasses, and the remaining 396 classes as the others. Then
we found that ε(τ) has the least value when τ = 3.10 (seeFig. 7), i.e. our threshold value of Mahalanobis distance isτ = 3.10.
Now our construction of discriminant model has been
completed. The followings are the details of that model:
Given a class whose metric vector is x = (x1 , x2 , x3 , x4 , x5 )T .
• Mahalanobis distance function:zT R−1 z,
D(x) =
5
where
z=



x1 − 2.96 x2 − 1.02
,
,
1.53
1.29
x3 − 1.93 x4 − 72.8 x5 − 37.0
,
,
1.44
37.0
13.9

and

T
,

Fig. 7

Table 6

Sum of error rates ε(τ).

Means and standard deviations of metric values in Eclipse.

group

µ, σ

DIT

NAI

NCM

NCV

NM

high-costclassesothers

µ1
σ1
µ2

2.00
1.07
2.79

8.13
9.78
3.75

2.13
3.27
2.69

47.25
109.7377.45

122.13
98.04
47.60

DIT
NAI
NCM NCV 8.06
0.359
2.32
−6.19

1.57
0.545 −0.578 0.359
0.545
14.0
−1.22
R−1 =  2.32
 −6.19 −0.578 −1.22
6.77

−3.75 0.513 −14.0 0.766

NM−3.75 0.513 
−14.0 .

0.766 17.1

• Discriminant rule:if D(x) ≥ τ = 3.10 then we consider the class is a costprone class; otherwise, the class is not cost-prone. 
Table 6 shows the means and the standard deviationsof the metric values in Eclipse. Since we can see µ2 ∈[µ1 − σ1 , µ1 + σ1 ], i.e. the mean points of the two groups
stay in close, our MT-based model would be better in discriminating cost-prone classes than the existing statistical
discriminant models discussed in Sect. 2.1.
4.1.4 Prediction of Cost-Prone Classes in Eclipse Ver.2.1
We have constructed a discriminant model using data of
Eclipse ver.2.0: the metric data of ver.2.0 and the versionupgrade data in ver.2.0 → 2.1. Now we apply the model tothe metric data of ver.2.1 to predict cost-prone classes in thenext version-upgrade ver.2.1 → 3.0.
We had 618 classes in Eclipse ver.2.1, and inputed their
metric data into the model constructed. Notice that the 618
classes include not only upgraded classes (modified LOC> 0) but also non-modified ones (modified LOC = 0).
The model predicted that 210 classes are cost-prone,and 408 classes are the others. Table 7 shows statistics oftheir actual modified LOC in the version-upgrade ver.2.1 →3.0 where µ and σ denote the mean and the standard deviation of modified LOC, respectively.

AMAN et al.: A MODEL FOR DETECTING COST-PRONE CLASSES BASED ON MAHALANOBIS-TAGUCHI METHOD

1355
Table 7

Statistics of modified LOC in classes predicted.

prediction

number of classµσ

cost-prone
others

210
408

181
42.3

397
70.9

4.1.5 Statistical Test
Finally we performed a statistical test in order to validate theabove predictions made by our model.
In this empirical work, we have considered that costprone classes would have large modified LOC in further
version-upgrades. Thus the set of cost-prone classes predicted by our model should have a statistically significant
diﬀerence from the set of other classes in their modified
LOC, i.e. it should be statistically showed that our costprone classes have larger modified LOC than the others.
We make the following hypotheses:
H0 (null hypothesis)
The mean of modified LOC in classes predicted as
cost-prone (µ1 ) is equal to the mean of that in the otherclasses (µ0 ): µ0 = µ1 .
H1 (alternative hypothesis-1)
The mean of modified LOC in classes predicted as
cost-prone is grater than the mean of that in the otherclasses: µ1 > µ0 .
H1 (alternative hypothesis-2)
The mean of modified LOC in classes predicted as
cost-prone is “exactly” grater than the mean of that inthe other classes: µ1 > 2µ0 .
The test can be performed with the normal probability distribution. Notice that this case corresponds to a testin large size samples; the sizes of two groups are 210 and
408. If our sample size is small (< 30), we should perform
Student’s t-test instead [25].
Let X 1 and X 0 be the sample means of modified LOC
in the classes predicted as cost-prone and as the others, respectively. Similarly let s1 and s0 denote the sample standard deviations of modified LOC in the classes predicted as
cost-prone and as the others, respectively. Assume the null
hypothesis H0 is true. Then the distribution of X 1 − X 0 is thenormal distribution N(0, σ2s ), where

s2
s21
+ 0 ,
σs =
n s1
n s0
and n s1 and n s0 are the numbers of classes predicted as costprone and as the others, respectively. From Table 7, we have
X 1 − X 0 = 138.7, and σ s = 27.7. In this case, the p-value is
2.72×10−07 , and the null hypothesis (H0 ) can be rejected; we
can accept the alternative hypothesis-1 (H1 ) with the significance level 0.00001%. When we replace X 0 with 2X 0 , thep-value is 2.50 × 10−4 . We can also accept the alternative
hypothesis-2 (H1 ) with the significance level 0.1%.
Therefore we could validate that our model has a highability for predictively discriminating cost-prone classes in
Eclipse jdt.core component.
4.2 Other Software: Azureus and jEdit
We also performed our model constructions and statistical validations to other open-source software: Azureus [26],and jEdit [27]. Azureus is a cross-platform Java BitTorrent
client, and that is a heavily-downloaded software in SourceForge.net [28] (it is No.1 on the download-count ranking at
the time of writing this paper). jEdit is a programmer’s text
editor written in Java, and that has been maintained for 5
years at SourceForge.net.
We collected 2, 549 classes and 618 classes from
Azureus (ver.2.0.8.2, 2.1.0.0 and 2.2.0.0) and jEdit (ver.4.0,
4.1 and 4.2), respectively. We present only their empiricalresults for lack of space.
• Azureus
In measurements of classes included in Azureus, thefollowing six metrics were independent: DIT, NAI,
NCM, NCV, NMO, and PIM; hence we used those six
metrics for our model construction. Note that the selection procedure of metrics is the same as the caseof Eclipse, i.e. we selected independent metrics suchthat the absolute values of correlation coeﬃcients in all
metrics pairs are less than 0.4† (see Algorithm 1).
The model predicted that 23 classes are cost-prone
ones, and the remaining 595 classes are the others.
Since this case corresponds to a small sample size, we
performed Student’s t-test with the degree of freedom
616(= 23+595−2). The test results said the alternative
hypothesis-1 (H1 ) could be accepted with the significance level 0.001% (p-value = 4.87 × 10−5 ), and the alternative hypothesis-2 (H1 ) could be also accepted withthe significance level 1% (p-value = 0.00575).
• jEdit
We constructed our discriminant model using the following four metrics†† that are independent in the measurements of classes included in jEdit: DIT, NAI,
NCM, and NMO.
The model predicted that 7 classes are cost-prone ones,
and the remaining 162 classes are the others. We also
performed Student’s t-test with the degree of freedom167(= 7 +162 − 2) in this case. As the results, we could
accept the alternative hypothesis-1 (H1 ) (p-value is approximately 0; it was too small to evaluate in our computer environment), and we could also accept the alternative hypothesis-2 (H1 ) with the significance level
0.000000000001% (p-value = 3.22 × 10−15 ).
We summarize our empirical results in Table 8. Theseempirical results statistically show our discriminant model isa useful model for predictively detecting cost-prone classes.
†

The threshold value is determined according to the literature [22].
††The selection procedure of metrics is also the same as thecases of Eclipse and Azureus.

IEICE TRANS. INF. & SYST., VOL.E89–D, NO.4 APRIL 2006

1356
Table 8

Summary of empirical results.

softwaremetrics used in the model

p-value(H1 : µ1 > 2µ0 )EclipseAzureusjEdit

DIT, NAI, NCM, NCV, NM
DIT, NAI, NCM, NCV, NMO, PIM
DIT, NAI, NCM, NMO

2.50 × 10−4
5.75 × 10−3
3.22 × 10−15

We have used diﬀerent metrics suites for diﬀerent software, Eclipse, Azureus, and jEdit. It is natural that diﬀerent software have diﬀerent quality characteristics, and require diﬀerent metrics suites for representing their quality
attributes. Our model could flexibly accept the diﬀerences in
the metrics for all software. A software requiring more metrics may have more complex distribution of metric data, then
may be harder for discriminating cost-prone classes from theothers, and vice versa. That might be one of interpretationsof the diﬀerences in the empirical results shown in Table 8;
the more metrics used in the model leads to the higher (themore wrong) p-value.
5. Conclusion and Future Work
We have proposed a model for predictively discriminating“cost-prone” classes, based on Mahalanobis-Taguchi (MT)method. MT method is a powerful method to detect low
quality products using some observable properties, and wehave applied the idea of MT method to object-oriented
software quality control. The model proposed in this paper has been designed for discriminating cost-prone classes
from the others using object-oriented software metrics. Thismodel overcomes failings of the existing statistical discriminant methods [15]–[17] and regression models [8]–[10].
In our empirical work, we collected 5, 760 classes
written in Java from three open-source software projects:
Eclipse, Azureus, and jEdit. For each software, we constructed the discriminant models, and performed statisticaltests to validate the models. The empirical results show
our model can predictively discriminate cost-prone classes
from the others, with the significance level 1% (p-values
are 2.50 × 10−4 , 5.75 × 10−3 and 3.22 × 10−15 in Eclipse,
Azureus and jEdit, respectively.) The proposed model will
be useful in predictively detecting cost-prone classes written in Java, and would aid eﬀective reviews and testings ofobject-oriented software.
The proposed model could be a general framework forpredicting software quality attributes using software metrics, since the model has no restrictions on metrics to be
used (excepting independency), and on quality attributes tobe predicted (not only “cost-proneness”). The application ofthis model into other quality attributes will be one of our future work. The followings will also be our future work: (1)investigation of automatically generated and/or reused code(including code clones [29]) eﬀects on our model, (2) studyof the impact of comment statements, excluded in our empirical work, on version-upgrades, and (3) analysis of sourcecode changing histories [30], [31] and failure reports [32],[33] in order to find other useful factors for enhancement ofour model.
Acknowledgments
The authors would like to thank the developers of opensource software used in the empirical studies. The authors also wish to thank the anonymous reviewers for theirthoughtful and helpful comments.
This research was partially supported by the Inamori
Foundation, and the Ministry of Education, Science, Sports
and Culture, Grant-in-Aid for Young Scientists (B), 2004,
16700037.
References[1] S.L. Pfleeger, Software Engineering, 2nd ed., Prentice Hall, London,
2001.
[2] C. Kaner, J. Falk, and H.Q. Nguyen, Testing Computer Software,
2nd ed., John Wiley & Sons, New York, 1999.
[3] G. Sabaliauskaite, S. Kusumoto, and K. Inoue, “Extended metrics
to evaluate cost eﬀectiveness of software inspection,” IEICE Trans.
Inf. & Syst., vol.E87-D, no.2, pp.475–480, Feb. 2004.
[4] R.K. Bandi, V.K. Vaishnavi, and D.E. Turk, “Predicting maintenance performance using object-oriented design complexity metrics,” IEEE Trans. Softw. Eng., vol.29, no.1, pp.77–87, Jan. 2003.
[5] K. Pillai and V.S.S. Nair, “A model for software development eﬀort
and cost estimation,” IEEE Trans. Softw. Eng., vol.23, no.8, pp.485–
497, Aug. 1997.
[6] F. Fioravanti and P. Nesi, “Estimation and prediction metrics
for adaptive maintenance eﬀort of object-oriented systems,” IEEE
Trans. Softw. Eng., vol.27, no.12, pp.1062–1084, Dec. 2001.
[7] M. Jorgensen, “Experience with the accuracy of software maintenance task eﬀort prediction models,” IEEE Trans. Softw. Eng.,
vol.21, no.8, pp.674–681, Aug. 1995.
[8] W. Li and S. Henry, “Object-oriented metrics that predict maintainability,” J. Syst. Softw., vol.23, pp.111–122, 1993.
[9] S. Wake and S. Henry, “A model based on software quality factors
which predicts maintainability,” Proc. Conf. on Software Maintenance, pp.382–387, Oct. 1988.
[10] M. Alshayeb and W. Li, “An empirical validation of object-oriented
metrics in two diﬀerent iterative software processes,” IEEE Trans.
Softw. Eng., vol.29, no.11, pp.1043–1049, Nov. 2003.
[11] V.R. Basili, L.C. Briand, and W.L. Melo, “A validation of objectoriented design metrics as quality indicators,” IEEE Trans. Softw.
Eng., vol.22, no.10, pp.751–761, Oct. 1996.
[12] L.C. Briand, W.L. Melo, and J. Wust, “Assessing the applicabilityof fault-proneness models across object-oriented software project,”
IEEE Trans. Softw. Eng., vol.28, no.7, pp.706–720, July 2002.
[13] L.C. Briand, V.R. Basili, and W.M. Thomas, “A pattern recognition approach for software engineering data analysis,” IEEE Trans.
Softw. Eng., vol.18, no.11, pp.931–942, Nov. 1992.
[14] H. Aman, N. Mochiduki, H. Yamada, and M.T. Noda, “A simple
predictive method for discriminating costly classes using class size
metric,” IEICE Trans. Inf. & Syst., vol.E88-D, no.6, pp.1284–1288,
June 2005.
[15] C.J. Huberty, Applied Discriminant Analysis, John Wiley & Sons,
New York, 1994.
[16] B.F. Manly, Multivariate Statistical Methods, Chapman & Hall, London, 1986.
[17] N. Mochiduki, H. Aman, H. Yamada, and M.T. Noda, “A predictive
discrimination of software modification eﬀort using class size metrics,” in Foundation of Software Engineering XI, ed. M. Noro and S.
Yamamoto, pp.93–96, Kindai Kagaku Sha, Tokyo, 2004.

AMAN et al.: A MODEL FOR DETECTING COST-PRONE CLASSES BASED ON MAHALANOBIS-TAGUCHI METHOD

1357[18] G. Taguchi, S. Chowdhury, and Y. Wu, The Mahalanobis-Taguchi
System, McGraw-Hill, OH, 2000.
[19] L.C. Briand, J. Wust, J.W. Daly, and D.V. Porter, “Exploring the relationships between design measures and software quality in objectoriented systems,” J. Syst. Softw., vol.51, pp.245–273, 2000.
[20] M. Lorenz and J. Kidd, Object-Oriented Software Metrics, Prentice
Hall, NJ, 1994.
[21] S.R. Chidamber and C.F. Kemerer, “A metrics suite for object oriented design,” IEEE Trans. Softw. Eng., vol.20, no.6, pp.476–493,
June 1994.
[22] P.G. Hoel, Elementary Statistics, John Wiley & Sons, New York,1976.
[23] E.L. Crow, F.A. Davis, and M.W. Maxfield, Statistics Manual,
Dover, New York, 1955.
[24] http://www.eclipse.org/[25] M.R. Spiegel, Theory and Problems of Probability and Statistics,
McGraw-Hill, OH, 1975.
[26] http://azureus.sourceforge.net/[27] http://www.jedit.org/[28] http://sourceforge.net/[29] T. Kamiya, S. Kusumoto, and K. Inoue, “CCFinder: A multilinguistic token-based code clone detection system for large scale source
code,” IEEE Trans. Softw. Eng., vol.28, no.7, pp.657–670, July
2002.
[30] A.T.T. Ying, G.C. Murphy, R. Ng, and M.C. Chu-Carroll, “Predicting source code changes by mining change history,” IEEE Trans.
Softw. Eng., vol.30, no.9, pp.574–586, Sept. 2004.
[31] T.L. Graves, A.F. Karr, J.s. Marron, and H. Siy, “Predicting fault
incidence using software change history,” IEEE Trans. Softw. Eng.,
vol.26, no.6, pp.653–661, July 2000.
[32] M. Fischer, M. Pinzger, and H. Gall, “Analyzing and relating bug report data for feature tracking,” Proc. 10th Working Conf. on Reverse
Engineering (WCSE’03), pp.90–99, 2003.
[33] M. Fischer, M. Pinzger, and H. Gall, “Populating a release history database from version control and bug tracking systems,” Proc.
International Conf. on Softw. Maintenance (ICSM’03), pp.23–33,
2003.

Appendix A: Mahalanobis Distance
In measuring the “distance” between two points in a space,
we commonly use Euclidean distance: for example, in a
two-dimensional space, the (Euclidean) distance between
p1 = (x1 , y1 )T and p2 = (x2 , y2 )T is expressed as| p1 − p2 | =(x1 − x2 )2 + (y1 − y2 )2 .

However Euclidean distance may not be useful for aclassification of entity on the scatter diagram (i.e. discriminant analysis) since it can not consider “dispersion” ofdata. For example, Fig. A· 1 is a scatter diagram plotting
entities that are categorized into two groups A and B. The
entities of group A and B are denoted by circles (◦) andcrosses (×), respectively. Now let x A = (1.71, 2.92)T andx B = (7.52, 4.04)T are the means of two groups, respectively. In Fig. A· 1, p = (4.70, 2.70)T seem to be closer togroup B than A. However p is nearer to x A than x B in Euclidean distance:| p − x A | ( 8.98) < | p − x B | ( 9.74)
2

Fig. A· 1

Two groups of data.

the perpendicular bisector between x A and x B (see Fig. 1)
classifies p into inappropriate group, A.
Mahalanobis distance is diﬀerent from Euclidean distance in considering dispersion of data. The variance andcovariance of data are also used to calculate Mahalanobis
distance. While Euclidean distance between p and x A(| p − x A |E ) has been given by| p − x A |2E = ( p − x A )T ( p − x A ) ,Mahalanobis distance between them (| p−x A | M ) is calculatedusing the following equation:| p − x A |2M = ( p − x A )T S −1
A ( p − x A) ,where S A is the variance-covariance matrix for the data ofgroup A. We can also calculate Mahalanobis distance forgroup B in the similar way. Mahalanobis distance is a groupspecific distance that is based on dispersion of data, i.e. thevariance-covariance matrix. For example, let S A and S B are
0.0508 0.00748
4.87 0.256
SA =, SB =.
0.00748 0.251
0.256 1.76
Then we obtain| p − x A |2M = ( p − x A )T S −1
A ( p − x A)

178 ,| p − x B |2M = ( p − x B )T S −1
B ( p − xB )2.44 .

and

Therefore we see | p − x B | M < | p − x A | M , and p will be categorized into group B by the Mahalanobis distance-based
discriminator.
Appendix B:

LOC Modified in Version-Upgrade

2

Thus a linear boundary based on Euclidean distance such as

In this paper, LOC modified in a version-upgrade is considered to be the number of diﬀerent lines of source codes in

IEICE TRANS. INF. & SYST., VOL.E89–D, NO.4 APRIL 20061358

two diﬀerent versions, excepting comment statements andempty (only white space(s)) lines.
Given a version-upgrade case of a source code: let S 1and S 2 be the older code and the newer one, respectively.
We can get the same code as S 2 by iterating one of the following operations:whose header are “+,” “-,” and “!” correspond to the addedlines, the removed ones, and the changed ones, respectively.
From the above definition, we can get the modified LOC in
Fig. A· 2 as 4(= n1 + n2 + max(n3 , n3 ) = 1 + 1 + 2).

(1) insert consecutive n1 (≥ 1) lines into S 1 ;(2) remove consecutive n2 (≥ 1) lines from S 1 ;(3) replace consecutive n3 (≥ 1) lines with another consecutive n3 (≥ 1) lines in S 1 .
Regard the above operations (1), (2), and (3) as“adding,” “removing,” and “changing,” respectively. Thendefine modified LOC as the total count of lines involved in
the above operations: (1) n1 , (2) n2 , and (3) max(n3 , n3 ),where max(a, b) is a if a > b otherwise b.
We can capture the lines involved in the above operations using Unix command diff; our empirical studies used“GNU diﬀutils ver.2.8.1” with the option “-cbwB.” These
options have the following functions:• “-c”: use the context output format;• “-b”: ignore changes in amount of white space;• “-w”: ignore white space when comparing lines;• “-B”: ignore changes that just insert or delete blanklines.

Hirohisa Aman
received the Dr. degree inEngineering from Kyushu Institute of Technology, Kitakyushu, Japan, in 2001. Since 2001,
he has been with Ehime University. He is currently an assistant professor of the Faculty ofEngineering, Ehime University. His primary research interest is in software maintenance costestimation using metrics. He is a member of Information Processing Society of Japan (IPSJ),
Japan Society for Software Science and Technology (JSSST), the Institute of Electrical andElectronics Engineering (IEEE), and Japan Society for Fuzzy Theory andIntelligent Informatics (SOFT).

Naomi Mochiduki
received the Masters
degree in Computer Science from Ehime University, Matsuyama, Japan, in 2005. She iscurrently with the FUJITSU Broad Solution &Consulting, Inc. She is a member of IPSJ.

Figure A· 2 shows an example of use of diff commandfor two Java source files in which all comment statements
are erased in advance; we have developed a tool for erasing all comment statements from a Java source file, and thetool has used in our empirical studies. In Fig. A· 2, the lines
Hiroyuki Yamada
received the Dr. degree
in Engineering from Osaka University, Suita,
Japan, in 1988. Since 1988, he has been with
Ehime University. He is currently an associate
professor of the Faculty of Engineering, Ehime
University. His primary research interests are in
the field of knowledge-based software engineering, especially, software requirements acquisition and software evolution. He is a memberof IPSJ, JSSST, IEEE, Association for Computing Machinery (ACM), and Japanese Society for
Artificial Intelligence (JSAI).

Fig. A· 2

Example of output of diff.