<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE article  PUBLIC "-//NLM//DTD Journal Publishing DTD v3.0 20080202//EN" "http://dtd.nlm.nih.gov/publishing/3.0/journalpublishing3.dtd"><article xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink" dtd-version="3.0" xml:lang="en" article-type="research article"><front><journal-meta><journal-id journal-id-type="publisher-id">JCC</journal-id><journal-title-group><journal-title>Journal of Computer and Communications</journal-title></journal-title-group><issn pub-type="epub">2327-5219</issn><publisher><publisher-name>Scientific Research Publishing</publisher-name></publisher></journal-meta><article-meta><article-id pub-id-type="doi">10.4236/jcc.2022.102003</article-id><article-id pub-id-type="publisher-id">JCC-115506</article-id><article-categories><subj-group subj-group-type="heading"><subject>Articles</subject></subj-group><subj-group subj-group-type="Discipline-v2"><subject>Computer Science&amp;Communications</subject></subj-group></article-categories><title-group><article-title>
 
 
  Fault Prediction with Static Software Metrics in Evolving Software: A Case Study in Apache Ant
 
</article-title></title-group><contrib-group><contrib contrib-type="author" xlink:type="simple"><name name-style="western"><surname>Xue</surname><given-names>Han</given-names></name><xref ref-type="aff" rid="aff1"><sup>1</sup></xref><xref ref-type="corresp" rid="cor1"><sup>*</sup></xref></contrib><contrib contrib-type="author" xlink:type="simple"><name name-style="western"><surname>Gongjun</surname><given-names>Yan</given-names></name><xref ref-type="aff" rid="aff1"><sup>1</sup></xref></contrib></contrib-group><aff id="aff1"><addr-line>Romain College of Business, University of Southern Indiana, Evansville, USA</addr-line></aff><pub-date pub-type="epub"><day>10</day><month>02</month><year>2022</year></pub-date><volume>10</volume><issue>02</issue><fpage>33</fpage><lpage>45</lpage><history><date date-type="received"><day>13,</day>	<month>November</month>	<year>2021</year></date><date date-type="rev-recd"><day>22,</day>	<month>February</month>	<year>2022</year>	</date><date date-type="accepted"><day>25,</day>	<month>February</month>	<year>2022</year></date></history><permissions><copyright-statement>&#169; Copyright  2014 by authors and Scientific Research Publishing Inc. </copyright-statement><copyright-year>2014</copyright-year><license><license-p>This work is licensed under the Creative Commons Attribution International License (CC BY). http://creativecommons.org/licenses/by/4.0/</license-p></license></permissions><abstract><p>
 
 
  Software testing is an integral part of software development. Not only that testing exists in each software iteration cycle, but it also consumes a considerable amount of resources. While resources such as machinery and manpower are often restricted, it is crucial to decide where and how much effort to put into testing. One way to address this problem is to identify which components of the subject under the test are more error-prone and thus demand more testing efforts. Recent development in machine learning techniques shows promising potential to predict faults in different components of a software system. This work conducts an empirical study to explore the feasibility of using static software metrics to predict software faults. We apply four machine learning techniques to construct fault prediction models from the PROMISE data set and evaluate the effectiveness of using static software metrics to build fault prediction models in four continuous versions of Apache Ant. The empirical results show that the combined software metrics generate the least misclassification errors. The fault prediction results vary significantly among different machine learning techniques and data set. Overall, fault prediction models built with the support vector machine (SVM) have the lowest misclassification errors.
 
</p></abstract><kwd-group><kwd>Software Engineering</kwd><kwd> Fault Prediction</kwd><kwd> Software Metrics</kwd><kwd> Machine Learning</kwd></kwd-group></article-meta></front><body><sec id="s1"><title>1. Introduction</title><p>Testing is a crucial part of the software development life cycle [<xref ref-type="bibr" rid="scirp.115506-ref1">1</xref>]. Ultimately, the purpose of testing is to expose all faults in the software system. A solid testing strategy can provide a high level of confidence about the correctness of an application after it has been deployed. However, software testing can be resource-demanding [<xref ref-type="bibr" rid="scirp.115506-ref2">2</xref>]. Detecting faults in a system randomly may not be feasible [<xref ref-type="bibr" rid="scirp.115506-ref3">3</xref>] especially when dealing with large-scale projects. Practitioners (developers and testers) want to allocate resources in the most effective ways to find faults.</p><p>Prior research [<xref ref-type="bibr" rid="scirp.115506-ref4">4</xref>] shows that a fault found after deployment can be 100 times as costly to fix in an early stage. Researchers strive to find a way to help practitioners to detect software faults as early as possible [<xref ref-type="bibr" rid="scirp.115506-ref5">5</xref>]. The decisions of when and where to put the testing efforts are often based on developers’ experience and expertise. This approach might not be reliable. It may not even be sustainable and consistent as developers move in and out of an organization [<xref ref-type="bibr" rid="scirp.115506-ref6">6</xref>]. The experience-based approach also varies a lot since practitioners have different perspectives regarding how to conduct testing.</p><p>With recent advancements in applying AI technologies to software engineering problems [<xref ref-type="bibr" rid="scirp.115506-ref7">7</xref>], many research reports promising preliminary results using machine learning techniques to predict faults in software systems [<xref ref-type="bibr" rid="scirp.115506-ref8">8</xref>] [<xref ref-type="bibr" rid="scirp.115506-ref9">9</xref>] [<xref ref-type="bibr" rid="scirp.115506-ref10">10</xref>]. This study explores what software metrics [<xref ref-type="bibr" rid="scirp.115506-ref11">11</xref>] are suitable for constructing fault prediction models and examine how well those machine learning models perform in predicting faults.</p><p>Unlike prior research [<xref ref-type="bibr" rid="scirp.115506-ref12">12</xref>] that depends on similar projects to build the prediction model, this study collects training data through different versions of the same project. Out approach outputs a much reliable representation of the application to build fault prediction models. It is also more practical to collect training data as the subject project evolves than to search for similar projects in the wild.</p><p>This study aims to answer the following research questions when conducting the empirical study.</p><p>&#183; What static software metrics can provide the best faults prediction result?</p><p>&#183; Which machine learning models give the best fault prediction results?</p><p>&#183; How well do prediction models perform across the continuous versions of the subject program?</p><p>We make the following contributions in this paper.</p><p>&#183; An empirical study in fault prediction with software metrics.</p><p>&#183; An evaluation of four different fault prediction models.</p><p>&#183; A publicly accessible data set.</p><p>&#183; A publicly accessible machine learning code (in MATLAB).</p><p>This paper is organized as follows. In Section 2, we present the overall approach of the empirical study. In Section 3, we discuss the research questions and explain the design of the experiments. In Section 4, we examine the study results. In Section 5, we discuss the sensitivity analysis and the threat to validity. Lastly, we conclude the empirical study in Section 6.</p></sec><sec id="s2"><title>2. Approaches</title><p>In this section, we discuss the overall approach adopted by this empirical study. <xref ref-type="fig" rid="fig1">Figure 1</xref> shows an overview of the approach. In the pre-processing phase, we extract and synthesize software metrics [<xref ref-type="bibr" rid="scirp.115506-ref8">8</xref>] [<xref ref-type="bibr" rid="scirp.115506-ref13">13</xref>] from the subject programs. In the model construction phase, we build fault prediction models and conduct sensitivity analysis to fine-tune the model hyperparameters.</p><sec id="s2_1"><title>2.1. Data Pre-Processing</title><p>We use static code analysis [<xref ref-type="bibr" rid="scirp.115506-ref14">14</xref>] to extract software metrics. Static software metrics is chosen over runtime software metrics for consistency concerns. For instance, instrumentation and monitor tools may be used to get the runtime metrics which may introduce high runtime overhead and disturb the execution of the subject program [<xref ref-type="bibr" rid="scirp.115506-ref15">15</xref>]. Also, depending on the deployment environment (e.g., physical or virtual machines running the subject program), we may get a completely different set of metrics readings [<xref ref-type="bibr" rid="scirp.115506-ref16">16</xref>]. <xref ref-type="table" rid="table1">Table 1</xref> lists the static software metrics used in the study.</p><p>Static software metrics undergo a series of pre-processing steps. First, we apply normalization [<xref ref-type="bibr" rid="scirp.115506-ref17">17</xref>] to bring metrics to the same scale while maintaining relative significance. For example, the value of the metric “Lack of Cohesion in Methods</p><table-wrap id="table1" ><label><xref ref-type="table" rid="table1">Table 1</xref></label><caption><title> Static software metrics</title></caption><table><tbody><thead><tr><th align="center" valign="middle" >METRIC</th><th align="center" valign="middle" >DESCRIPTION</th><th align="center" valign="middle" >OO METRIC</th><th align="center" valign="middle" >DESCRIPTION</th></tr></thead><tr><td align="center" valign="middle" >Files</td><td align="center" valign="middle" ># of files</td><td align="center" valign="middle" >WMC</td><td align="center" valign="middle" >Weighted method count</td></tr><tr><td align="center" valign="middle" >Lines</td><td align="center" valign="middle" >Line of code</td><td align="center" valign="middle" >DIT</td><td align="center" valign="middle" >Depth of inheritance tree</td></tr><tr><td align="center" valign="middle" >AVG-Len</td><td align="center" valign="middle" >Average code length</td><td align="center" valign="middle" >NOC</td><td align="center" valign="middle" >The number of children for a class</td></tr><tr><td align="center" valign="middle" >Cd/Cm + WS</td><td align="center" valign="middle" >Code non-code ratio</td><td align="center" valign="middle" >CA</td><td align="center" valign="middle" >Afferent coupling</td></tr><tr><td align="center" valign="middle" >Cd/Cm</td><td align="center" valign="middle" >Code comments ratio</td><td align="center" valign="middle" >CE</td><td align="center" valign="middle" >Efferent coupling</td></tr><tr><td align="center" valign="middle" >Cd/File</td><td align="center" valign="middle" >Code file ratio</td><td align="center" valign="middle" >DAM</td><td align="center" valign="middle" >Data access metric</td></tr><tr><td align="center" valign="middle" >Cm/File</td><td align="center" valign="middle" >Comment file ratio</td><td align="center" valign="middle" >MOA</td><td align="center" valign="middle" >Measure of aggregation</td></tr></tbody></table></table-wrap><p>(LCOM)” [<xref ref-type="bibr" rid="scirp.115506-ref13">13</xref>] could range from 0 to 2247 in dataset 3 before normalizing to the range of 0 to 1. It reduces the dramatic range in the metrics value space that may otherwise negatively affect the accuracy of the prediction models.</p><p>Not all static software metrics are suitable for constructing the fault prediction model. Some of them may even reduce the model’s accuracy. Next, a forward and backward feature selection [<xref ref-type="bibr" rid="scirp.115506-ref18">18</xref>] is applied to reduce the feature space dimensionality and to achieve greater generalization.</p></sec><sec id="s2_2"><title>2.2. Fault Prediction Models</title><p>In the second phase, we apply both supervised and unsupervised machine learning techniques to build fault prediction models. Decision Tree (DT) [<xref ref-type="bibr" rid="scirp.115506-ref19">19</xref>] is a classic supervised learning model. The tree is constructed by a recursive binary split on which the selected node maximizes local information gain [<xref ref-type="bibr" rid="scirp.115506-ref13">13</xref>]. We use Gini’s Diversity Index [<xref ref-type="bibr" rid="scirp.115506-ref20">20</xref>] g d i = 1 − Σ i p 2 ( i ) for tree pruning. Random Forest (RF) [<xref ref-type="bibr" rid="scirp.115506-ref21">21</xref>] is an ensemble method. RF combines an arbitrary number of decision trees. The number of decision trees used for each data set is based on a sensitivity analysis which will be discussed in Section 5. Support Vector Machine (SVM) [<xref ref-type="bibr" rid="scirp.115506-ref22">22</xref>] is a linear classification model that maximizes the decision boundary. The linear kernel is used for two-class learning. G ( x j , x k ) = x j t x k where x<sub>j</sub>and x<sub>k</sub> are two observations. And an error-correcting output codes (ECOC) model for multi-class learning. K-nearest neighbor (KNN) [<xref ref-type="bibr" rid="scirp.115506-ref23">23</xref>] is an unsupervised learning method. KNN assumes that if two data points are similar, they are likely to be in the same class. We use the euclidean distance to calculate the shortest distance between a data point and the cluster’s centroid. We conduct a sensitivity analysis to evaluate different k values and select the k value that gives the least misclassification error [<xref ref-type="bibr" rid="scirp.115506-ref24">24</xref>] to construct KNN. To avoid overfitting [<xref ref-type="bibr" rid="scirp.115506-ref25">25</xref>], ten-fold cross-validation [<xref ref-type="bibr" rid="scirp.115506-ref26">26</xref>] is applied to all four models. Since ten-fold cross-validation randomly samples instances and puts them in ten folds [<xref ref-type="bibr" rid="scirp.115506-ref27">27</xref>], the process is repeated ten times for each model to avoid sampling bias [<xref ref-type="bibr" rid="scirp.115506-ref28">28</xref>].</p></sec></sec><sec id="s3"><title>3. Empirical Study</title><p>In this section, we discuss details of the implementation, subjects, and data set design.</p><sec id="s3_1"><title>3.1. Implementation</title><p>The experiment runs on a Mac OS X with a quad-core 2.4 GHz Intel Core-i5 CPU, 16 GB of memory, and 256 GB of SSD. We use CodeAnalyzer [<xref ref-type="bibr" rid="scirp.115506-ref29">29</xref>] to extract static software metrics. CodeAnalyzer is a light-weighted tool for analyzing source code. To build fault prediction models, we use the MATLAB Statistics Toolbox [<xref ref-type="bibr" rid="scirp.115506-ref30">30</xref>].</p></sec><sec id="s3_2"><title>3.2. Subjects and Data Sets</title><p>Apache Ant is an open-source Java-based build tool. Tour continuous versions (v1.4 to v1.7) of the Apache Ant is used for its popularity [<xref ref-type="bibr" rid="scirp.115506-ref31">31</xref>] and availability [<xref ref-type="bibr" rid="scirp.115506-ref32">32</xref>]. <xref ref-type="table" rid="table2">Table 2</xref> shows the characteristics of Apache Ant. The first column (METRIC) shows the size of the Apache Ant. The third column (RATIO) shows the proportion for source code. We refer to the online repository Models In Software Engineering (PROMISE) [<xref ref-type="bibr" rid="scirp.115506-ref32">32</xref>] for Apache Ant faults data. <xref ref-type="fig" rid="fig2">Figure 2</xref> shows the distribution of faults in the four versions of Apache Ant. Color schemes are used in the bar chart to indicate different numbers of faults in a class. For example, in the ANT-V4 data set, 78% (565) classes have zero fault and 12.5% (91) classes have one fault.</p><p>To prepare the raw training data set, we associate software metrics (features) of the training data with faults (labels) provided in the PROMISE by the module’s class name. With each modeling iteration, the training data set is expended and fault prediction models are rebuilt using techniques outlined in Section 2.2.</p></sec></sec><sec id="s4"><title>4. Results and Discussion</title><p>In this section, we answer the following research questions and discuss the study results.</p><p>&#183; RQ1: What static software metrics can provide the best fault prediction result?</p><table-wrap id="table2" ><label><xref ref-type="table" rid="table2">Table 2</xref></label><caption><title> Apache ant characteristics</title></caption><table><tbody><thead><tr><th align="center" valign="middle" >METRIC</th><th align="center" valign="middle" >VALUE</th><th align="center" valign="middle" >RATIO</th><th align="center" valign="middle" >VALUE</th></tr></thead><tr><td align="center" valign="middle" >Total Files</td><td align="center" valign="middle" >228</td><td align="center" valign="middle" >Code /(Comment + Whitespace) Ratio</td><td align="center" valign="middle" >0.81</td></tr><tr><td align="center" valign="middle" >Avg Line Length</td><td align="center" valign="middle" >34</td><td align="center" valign="middle" >Code/Whitespace Ratio</td><td align="center" valign="middle" >4.16</td></tr><tr><td align="center" valign="middle" >Comment Lines</td><td align="center" valign="middle" >25,590</td><td align="center" valign="middle" >Code Lines Per File</td><td align="center" valign="middle" >113</td></tr><tr><td align="center" valign="middle" >Total Lines</td><td align="center" valign="middle" >57,462</td><td align="center" valign="middle" >Code/Comment Ratio</td><td align="center" valign="middle" >1.01</td></tr><tr><td align="center" valign="middle" >Code Lines</td><td align="center" valign="middle" >25,838</td><td align="center" valign="middle" >Code/Total Lines Ratio</td><td align="center" valign="middle" >0.45</td></tr><tr><td align="center" valign="middle" >Whitespace Lines</td><td align="center" valign="middle" >6213</td><td align="center" valign="middle" >Comment Lines Per File</td><td align="center" valign="middle" >112</td></tr></tbody></table></table-wrap><p>&#183; RQ2: Which machine learning models give the best fault prediction results?</p><p>&#183; RQ3: How well do prediction models perform across the continuous versions of the Apache Ant?</p><sec id="s4_1"><title>4.1. RQ1: Software Metrics</title><p>We build models with three sets of metrics (<xref ref-type="table" rid="table1">Table 1</xref>). For each model, the default, complex, and combined metrics are used as the training data, respectively. <xref ref-type="table" rid="table3">Table 3</xref> shows a portion of the training data set for ANT-V1. For example, the “Module” column shows the class name; the “Weighted Methods per Class (WMC)” column is the sum of the complexities of all class methods; the “Bug” column shows the number of faults in the class. <xref ref-type="fig" rid="fig3">Figure 3</xref> shows the performance of fault prediction models with all three sets of metrics. Their performance varies among different data sets. For example, the complex metrics outperform the</p><table-wrap id="table3" ><label><xref ref-type="table" rid="table3">Table 3</xref></label><caption><title> ANT-V1</title></caption><table><tbody><thead><tr><th align="center" valign="middle" >Module</th><th align="center" valign="middle" >WMC</th><th align="center" valign="middle" >DIT</th><th align="center" valign="middle" >NOC</th><th align="center" valign="middle" >CBO</th><th align="center" valign="middle" >Cd/WS</th><th align="center" valign="middle" >Cd/File</th><th align="center" valign="middle" >Cm/File</th><th align="center" valign="middle" >Bug</th></tr></thead><tr><td align="center" valign="middle" >Ant Class Loader</td><td align="center" valign="middle" >17</td><td align="center" valign="middle" >2</td><td align="center" valign="middle" >0</td><td align="center" valign="middle" >9</td><td align="center" valign="middle" >1.02</td><td align="center" valign="middle" >236</td><td align="center" valign="middle" >231</td><td align="center" valign="middle" >2</td></tr><tr><td align="center" valign="middle" >Build Event</td><td align="center" valign="middle" >11</td><td align="center" valign="middle" >2</td><td align="center" valign="middle" >0</td><td align="center" valign="middle" >7</td><td align="center" valign="middle" >3.79</td><td align="center" valign="middle" >53</td><td align="center" valign="middle" >97</td><td align="center" valign="middle" >0</td></tr><tr><td align="center" valign="middle" >Constants</td><td align="center" valign="middle" >0</td><td align="center" valign="middle" >1</td><td align="center" valign="middle" >0</td><td align="center" valign="middle" >0</td><td align="center" valign="middle" >3</td><td align="center" valign="middle" >3</td><td align="center" valign="middle" >1</td><td align="center" valign="middle" >0</td></tr><tr><td align="center" valign="middle" >Main</td><td align="center" valign="middle" >14</td><td align="center" valign="middle" >1</td><td align="center" valign="middle" >0</td><td align="center" valign="middle" >7</td><td align="center" valign="middle" >5.32</td><td align="center" valign="middle" >367</td><td align="center" valign="middle" >178</td><td align="center" valign="middle" >1</td></tr><tr><td align="center" valign="middle" >Project Helper</td><td align="center" valign="middle" >17</td><td align="center" valign="middle" >1</td><td align="center" valign="middle" >0</td><td align="center" valign="middle" >19</td><td align="center" valign="middle" >4.63</td><td align="center" valign="middle" >482</td><td align="center" valign="middle" >141</td><td align="center" valign="middle" >3</td></tr><tr><td align="center" valign="middle" >Zip</td><td align="center" valign="middle" >22</td><td align="center" valign="middle" >4</td><td align="center" valign="middle" >1</td><td align="center" valign="middle" >15</td><td align="center" valign="middle" >4.17</td><td align="center" valign="middle" >192</td><td align="center" valign="middle" >126</td><td align="center" valign="middle" >3</td></tr></tbody></table></table-wrap><p>default metrics in ANT-V1 with DT but fall short in ANT-V2 compared to default metrics. On average, models built with combined metrics has the lowest misclassification error (0.2).</p></sec><sec id="s4_2"><title>4.2. RQ2: Fault Prediction Model Performance</title><p>To answer RQ2, we compare the performance of models built with individual Apache Ant versions in <xref ref-type="fig" rid="fig4">Figure 4</xref>. The performance of fault prediction models varies across Apache Ant versions. For example, RF has a misclassification error of 0.09 in ANT-V2 compared to a misclassification error of 0.254 in ANT-V3. Overall, SVM has the least misclassification error (0.148) followed by RF (0.192), KNN (0.203), and DT (0.259). <xref ref-type="fig" rid="fig4">Figure 4</xref> shows models trained with ANT-V2 have the best performance with an average misclassification error of 0.103 compared to ANT-V1 (0.227), ANT-V3 (0.248), and ANT-V4 (0.225). It is our observation that for linearly separable spaces, KNN is preferred for its interpretability. KNN does require a larger data set for it to work accurately.</p></sec><sec id="s4_3"><title>4.3. RQ3: Cross Program Training and Fault Prediction</title><p>To answer RQ3, we examine whether training data from other project versions can improve fault prediction performance. To prepare the expended data set, we construct a new data set with all previous training data sets. For example, ANT-DS-2 contains data for ANT-DS-1 plus ANT-V2; and ANT-DS-3 contains data for ANT-DS-2 plus ANT-V3. <xref ref-type="fig" rid="fig5">Figure 5</xref> illustrates the performance of each fault prediction model with the expanded data set. Overall, the model prediction misclassification error is equivalent to the regular data set (MC<sub>expanded</sub> = 0.206 v.s. MC<sub>regular</sub> = 0.2). The misclassification error of models built with expanded data set outperform the regular data set in ANT-DS-3 (MC<sub>expanded</sub> = 0.198 v.s. MC<sub>regular</sub> = 0.248), ANT-DS-4 (MC<sub>expanded</sub> = 0.209 v.s. MC<sub>regular</sub> = 0.225) and underperform the regular data set in ANT-DS-2 (MC<sub>expanded</sub> = 0.214 v.s. MC<sub>regular</sub> = 0.103). The results imply in cases when training data for a subject is unavailable, we may</p><p>utilize training data of a different version of the same subject.</p></sec></sec><sec id="s5"><title>5. Discussions</title><p>In this section, we discuss the sensitivity analysis and the threats to validity of the empirical study.</p><sec id="s5_1"><title>5.1. Sensitivity Analysis</title><p>One challenge of using machine learning techniques is that we need to find proper values for the hyperparameters. To get a better fault prediction results, we try out different values to fine-tune the model. For example, <xref ref-type="fig" rid="fig6">Figure 6</xref> shows the influence on the number of random trees used in RF. For KNN, a different number of neighbors (<xref ref-type="fig" rid="fig7">Figure 7</xref>) were selected to minimize the classification errors. Empirical data indicates for Apache Ant the best number of neighbors fall between 13 and 16.</p></sec><sec id="s5_2"><title>5.2. Internal Validity</title><p>A threat to internal validity for this study is the possible faults in the implementation of our approach and the tools that we use to perform the evaluation. We control this threat by extensively testing our tools and verifying their results against a small program for which we can manually determine the correctness of the results. Another threat involves the selection of hyperparameters [<xref ref-type="bibr" rid="scirp.115506-ref33">33</xref>] used in machine learning techniques. We use the recommended settings for each modeling technique and conduct a sensitivity analysis to fine-tune the parameters. The accuracy of each fault prediction model may also be different with a different implementation. For example, the RF may report a different misclassification rate in scikit-learn [<xref ref-type="bibr" rid="scirp.115506-ref34">34</xref>] and weka [<xref ref-type="bibr" rid="scirp.115506-ref8">8</xref>] [<xref ref-type="bibr" rid="scirp.115506-ref35">35</xref>]. We choose the statistics and machine learning toolbox in MATLAB for its simplicity to use and its popularity (MATLAB has</p><p>been widely used in both industry and academia).</p></sec><sec id="s5_3"><title>5.3. External Validity</title><p>The primary threat to external validity for this study involves the representativeness of the selected subjects and modeling techniques. Other subjects may exhibit different characteristics and lead to other conclusions [<xref ref-type="bibr" rid="scirp.115506-ref36">36</xref>]. We reduce this threat by studying multiple versions of the subject program. In addition, we apply four different modeling techniques on seven data sets to generalize conclusions.</p></sec><sec id="s5_4"><title>5.4. Construct Validity</title><p>The primary threat to construct validity involves the dataset and software metrics used in the study. To mitigate this threat, we use data sets that are publicly available, well understood, and widely used [<xref ref-type="bibr" rid="scirp.115506-ref32">32</xref>]. We have also applied well-known software metrics in the data set that is straightforward to compute and is less error-prone.</p></sec><sec id="s5_5"><title>5.5. Limitations</title><p>The first limitation of this work is that our approach requires the source code to get the training data. In some cases, especially for a legacy program, the source code may not always be available [<xref ref-type="bibr" rid="scirp.115506-ref2">2</xref>]. Second, when preparing for the training data, it is not fully automated. Our approach first extracts static metrics from the source code, and then we manually combine the PROMISE labels (faults) to get the training data set. One solution is to automate the fault prediction model construction as part of the continuous integration (CI) [<xref ref-type="bibr" rid="scirp.115506-ref37">37</xref>]. We can leverage the fault information from the issue tracker to automatically append the labels to the training data set.</p></sec></sec><sec id="s6"><title>6. Conclusion</title><p>We conduct an empirical study to examine the effectiveness of building fault prediction models with static software metrics. We examine the effectiveness of metrics to build fault prediction models. We study four different types of fault prediction models with four continuous versions of the Apache Ant. We evaluate the performance of fault prediction models across multiple Apache Ant versions. Our results suggest the fault prediction models built with combined software metrics have the lowest overall misclassification error (0.2). Among all fault prediction models, SVM has the least misclassification error (0.148). Lastly, our results show the fault prediction models built with the expanded data set are equally powerful. In cases when training data for a subject is unavailable, we may utilize training data of a different version of the same subject.</p></sec><sec id="s7"><title>Conflicts of Interest</title><p>The authors declare no conflicts of interest regarding the publication of this paper.</p></sec><sec id="s8"><title>Cite this paper</title><p>Han, X. and Yan, G.J. (2022) Fault Prediction with Static Software Metrics in Evolving Software: A Case Study in Apache Ant. Journal of Computer and Communications, 10, 33-45. https://doi.org/10.4236/jcc.2022.102003</p></sec></body><back><ref-list><title>References</title><ref id="scirp.115506-ref1"><label>1</label><mixed-citation publication-type="other" xlink:type="simple">Ammann, P. and Offutt, J. (2016) Introduction to Software Testing. Cambridge University Press, Cambridge. https://doi.org/10.1017/9781316771273</mixed-citation></ref><ref id="scirp.115506-ref2"><label>2</label><mixed-citation publication-type="other" xlink:type="simple">Han, X., Carroll, D. and Yu, T. (2019) Reproducing Performance Bug Reports in Server Applications: The Researchers’ Experiences. Journal of Systems and Software, 156, 268-282. https://doi.org/10.1016/j.jss.2019.06.100</mixed-citation></ref><ref id="scirp.115506-ref3"><label>3</label><mixed-citation publication-type="other" xlink:type="simple">Sen, K., Marinov, D. and Agha, G. (2005) Cute: A Concolic Unit Testing Engine for C. ACM SIGSOFT Software Engineering Notes, 30, 263-272. https://doi.org/10.1145/1095430.1081750</mixed-citation></ref><ref id="scirp.115506-ref4"><label>4</label><mixed-citation publication-type="other" xlink:type="simple">Dawson, M., Burrell, D.N., Rahim, E. and Brewster, S. (2010) Integrating Software Assurance into the Software Development Life Cycle (SDLC). Journal of Information Systems Technology and Planning, 3, 49-53.</mixed-citation></ref><ref id="scirp.115506-ref5"><label>5</label><mixed-citation publication-type="other" xlink:type="simple">Boberg, J. (2008) Early Fault Detection with Model-Based Testing. Proceedings of the 7th ACM SIGPLAN workshop on ERLANG, Victoria, 27 September 2008, 9-20. https://doi.org/10.1145/1411273.1411276</mixed-citation></ref><ref id="scirp.115506-ref6"><label>6</label><mixed-citation publication-type="other" xlink:type="simple">Dore, T.L. (2004) The Relationships between Job Characteristics, Job Satisfaction, and Turnover Intention among Software Developers. Argosy University/Orange County, Atlanta.</mixed-citation></ref><ref id="scirp.115506-ref7"><label>7</label><mixed-citation publication-type="other" xlink:type="simple">Amershi, S., Begel, A., Bird, C., DeLine, R., Gall, H., Kamar, E., Nagappan, N., Nushi, B. and Zimmermann, T. (2019) Software Engineering for Machine Learning: A Case Study. 2019 IEEE/ACM 41st International Conference on Software Engineering: Software Engineering in Practice (ICSE-SEIP), Montreal, 25-31 May 2019, 291-300. https://doi.org/10.1109/ICSE-SEIP.2019.00042</mixed-citation></ref><ref id="scirp.115506-ref8"><label>8</label><mixed-citation publication-type="other" xlink:type="simple">Yu, T., Wen, W., Han, X. and Hayes, J.H. (2016) Predicting Testability of Concurrent Programs. 2016 IEEE International Conference on Software Testing, Verification and Validation (ICST), 11-15 April 2016, Chicago, 168-179. https://doi.org/10.1109/ICST.2016.39</mixed-citation></ref><ref id="scirp.115506-ref9"><label>9</label><mixed-citation publication-type="other" xlink:type="simple">Rathore, S.S. and Kumar, S. (2017) An Empirical Study of Some Software Fault Prediction Techniques for the Number of Faults Prediction. Soft Computing, 21, 7417-7434. https://doi.org/10.1007/s00500-016-2284-x</mixed-citation></ref><ref id="scirp.115506-ref10"><label>10</label><mixed-citation publication-type="other" xlink:type="simple">Yu, T., Wen, W., Han, X. and Hayes, J.H. (2018) Conpredictor: Concurrency Defect Prediction in Real-World Applications. IEEE Transactions on Software Engineering, 45, 558-575. https://doi.org/10.1109/TSE.2018.2791521</mixed-citation></ref><ref id="scirp.115506-ref11"><label>11</label><mixed-citation publication-type="other" xlink:type="simple">Schach, S.R. (2007) Object-Oriented and Classical Software Engineering. Vol. 6, McGraw-Hill, New York.</mixed-citation></ref><ref id="scirp.115506-ref12"><label>12</label><mixed-citation publication-type="other" xlink:type="simple">Chidamber, S.R. and Kemerer, C.F. (1994) A Metrics Suite for Object Oriented Design. IEEE Transactions on Software Engineering, 20, 476-493. https://doi.org/10.1109/32.295895</mixed-citation></ref><ref id="scirp.115506-ref13"><label>13</label><mixed-citation publication-type="other" xlink:type="simple">Aggarwal, K., Singh, Y., Kaur, A. and Malhotra, R. (2006) Empirical Study of Object-Oriented Metrics. Journal of Object Technology, 5, 149-173.</mixed-citation></ref><ref id="scirp.115506-ref14"><label>14</label><mixed-citation publication-type="journal" xlink:type="simple"><name name-style="western"><surname>Bardas</surname><given-names> A.G. </given-names></name>,<etal>et al</etal>. (<year>2010</year>)<article-title>Static Code Analysis</article-title><source> Romanian Economic Business Review</source><volume> 4</volume>,<fpage> 99</fpage>-<lpage>107</lpage>.<pub-id pub-id-type="doi"></pub-id></mixed-citation></ref><ref id="scirp.115506-ref15"><label>15</label><mixed-citation publication-type="other" xlink:type="simple">Uh, G.-R., Cohn, R., Yadavalli, B., Peri, R. and Ayyagari, R. (2006) Analyzing Dynamic Binary Instrumentation Overhead. WBIA Workshop at ASPLOS, Citeseer.</mixed-citation></ref><ref id="scirp.115506-ref16"><label>16</label><mixed-citation publication-type="other" xlink:type="simple">Potdar, A.M., Narayan, D., Kengond, S. and Mulla, M.M. (2020) Performance Evaluation of Docker Container and Virtual Machine. Procedia Computer Science, 171, 1419-1428. https://doi.org/10.1016/j.procs.2020.04.152</mixed-citation></ref><ref id="scirp.115506-ref17"><label>17</label><mixed-citation publication-type="other" xlink:type="simple">Zheng, A. and Casari, A. (2018) Feature Engineering for Machine Learning: Principles and techniques for Data Scientists. O’Reilly Media, Inc., Sebastopol.</mixed-citation></ref><ref id="scirp.115506-ref18"><label>18</label><mixed-citation publication-type="other" xlink:type="simple">Chandrashekar, G. and Sahin, F. (2014) A Survey on Feature Selection Methods. Computers &amp; Electrical Engineering, 40, 16-28. https://doi.org/10.1016/j.compeleceng.2013.11.024</mixed-citation></ref><ref id="scirp.115506-ref19"><label>19</label><mixed-citation publication-type="other" xlink:type="simple">Brijain, M., Patel, R., Kushik, M. and Rana, K. (2014) A Survey on Decision Tree Algorithm for Classification. International Journal of Engineering Development and Research, 2, 1-5.</mixed-citation></ref><ref id="scirp.115506-ref20"><label>20</label><mixed-citation publication-type="other" xlink:type="simple">Jost, L. (2006) Entropy and Diversity. Oikos, 113, 363-375. https://doi.org/10.1111/j.2006.0030-1299.14714.x</mixed-citation></ref><ref id="scirp.115506-ref21"><label>21</label><mixed-citation publication-type="other" xlink:type="simple">Biau, G. and Scornet, E. (2016) A Random Forest Guided Tour. Test, 25, 197-227. https://doi.org/10.1007/s11749-016-0481-7</mixed-citation></ref><ref id="scirp.115506-ref22"><label>22</label><mixed-citation publication-type="other" xlink:type="simple">Noble, W.S. (2006) What Is a Support Vector Machine? Nature Biotechnology, 24, 1565-1567. https://doi.org/10.1038/nbt1206-1565</mixed-citation></ref><ref id="scirp.115506-ref23"><label>23</label><mixed-citation publication-type="other" xlink:type="simple">L. E. Peterson (2009) K-Nearest Neighbor. Scholarpedia, 4, 1883. https://doi.org/10.4249/scholarpedia.1883</mixed-citation></ref><ref id="scirp.115506-ref24"><label>24</label><mixed-citation publication-type="book" xlink:type="simple">Moisen, G.G. (2008) Classification and Regression Trees. In: J&amp;oslash;rgensen, S.E. and Fath, B.D., Eds., Encyclopedia of Ecology, Vol. 1, Oxford, Elsevier, 582-588. https://doi.org/10.1016/B978-008045405-4.00149-X</mixed-citation></ref><ref id="scirp.115506-ref25"><label>25</label><mixed-citation publication-type="other" xlink:type="simple">Hawkins, D.M. (2004) The Problem of Overfitting. Journal of Chemical Information and Computer Sciences, 44, 1-12. https://doi.org/10.1021/ci0342472</mixed-citation></ref><ref id="scirp.115506-ref26"><label>26</label><mixed-citation publication-type="other" xlink:type="simple">Lee, T., Nam, J., Han, D., Kim, S. and In, H.P. (2011) Micro Interaction Metrics for Defect Prediction. Proceedings of the 19th ACM SIGSOFT Symposium and the 13th European Conference on Foundations of Software Engineering, Szeged, 5-9 September 2011, 311-321. https://doi.org/10.1145/2025113.2025156</mixed-citation></ref><ref id="scirp.115506-ref27"><label>27</label><mixed-citation publication-type="other" xlink:type="simple">Alpaydin, E. (2020) Introduction to Machine Learning. MIT Press, Cambridge. https://doi.org/10.7551/mitpress/13811.001.0001</mixed-citation></ref><ref id="scirp.115506-ref28"><label>28</label><mixed-citation publication-type="other" xlink:type="simple">Zadrozny, B. (2004) Learning and Evaluating Classifiers under Sample Selection Bias. Proceedings of the 21st International Conference on Machine Learning, Banff, 4-8 July 2004, 114. https://doi.org/10.1145/1015330.1015425</mixed-citation></ref><ref id="scirp.115506-ref29"><label>29</label><mixed-citation publication-type="other" xlink:type="simple">Code Analyzer (2013). https://sourceforge.net/projects/codeanalyze-gpl/</mixed-citation></ref><ref id="scirp.115506-ref30"><label>30</label><mixed-citation publication-type="other" xlink:type="simple">(2013) MATLAB and Statistics Toolbox Release. The MathWorks, Inc., Natick.</mixed-citation></ref><ref id="scirp.115506-ref31"><label>31</label><mixed-citation publication-type="other" xlink:type="simple">Nistor, A., Song, L., Marinov, D. and Lu, S. (2013) Toddler: Detecting Performance Problems via Similar Memory-Access Patterns. 2013 35th International Conference on Software Engineerin (ICSE), San Francisc, 18-26 May 2013, 562-571. https://doi.org/10.1109/ICSE.2013.6606602</mixed-citation></ref><ref id="scirp.115506-ref32"><label>32</label><mixed-citation publication-type="other" xlink:type="simple">Sayyad Shirabad, J. and Menzies, T. (2005) The PROMISE Repository of Software Engineering Databases. School of Information Technology and Engineering, University of Ottawa, Ottawa.</mixed-citation></ref><ref id="scirp.115506-ref33"><label>33</label><mixed-citation publication-type="other" xlink:type="simple">Probst, P., Boulesteix, A.-L. and Bischl, B. (2019) Tunability: Importance of Hyperparameters of Machine Learning Algorithms. The Journal of Machine Learning Research, 20, 1934-1965.</mixed-citation></ref><ref id="scirp.115506-ref34"><label>34</label><mixed-citation publication-type="other" xlink:type="simple">Han, X., Yu, T. and Pradel, M. (2021) Confprof: White-Box Performance Profiling of Configuration Options. Proceedings of the ACM/SPEC International Conference on Performance Engineering, Virtual, 19-23 April 2021, 1-8. https://doi.org/10.1145/3427921.3450255</mixed-citation></ref><ref id="scirp.115506-ref35"><label>35</label><mixed-citation publication-type="other" xlink:type="simple">Han, X., Yu, T. and Lo, D. (2018) Perflearner: Learning from Bug Reports to Understand and Generate Performance Test Frames. 2018 33rd IEEE/ACM International Conference on Automated Software Engineering (ASE), Montpellier, 3-7 September 2018, 17-28. https://doi.org/10.1145/3238147.3238204</mixed-citation></ref><ref id="scirp.115506-ref36"><label>36</label><mixed-citation publication-type="other" xlink:type="simple">Sj&amp;oslash;berg, D.I., Hannay, J.E., Hansen, O., Kampenes, V.B., Karahasanovic, A., Liborg, N.-K. and Rekdal, A.C. (2005) A Survey of Controlled Experiments in Software Engineering. IEEE Transactions on Software Engineering, 31, 733-753. https://doi.org/10.1109/TSE.2005.97</mixed-citation></ref><ref id="scirp.115506-ref37"><label>37</label><mixed-citation publication-type="other" xlink:type="simple">Fitzgerald, B. and Stol, K.-J. (2017) Continuous Software Engineering: A Roadmap and Agenda. Journal of Systems and Software, 123, 176-189. https://doi.org/10.1016/j.jss.2015.06.063</mixed-citation></ref></ref-list></back></article>