de l’information
2.1.2.1 WMC
This is the Weighted Methods per Class metric [30], and can be classified as a traditional complexity
metric. It is a count of the methods in a class. The developers of this metric leave the weighting scheme
as an implementation decision [30]. We weight it using cyclomatic complexity as did [78]. However, other
authors did not adopt a weighting scheme [4][106]. Methods from ancestor classes are not counted and
neither are “friends” in C++. This is similar to the approach taken in, for example, [4][31]. To be precise,8WMC was counted after preprocessing to avoid undercounts due to macros [33].
One study found WMC to be associated with fault-proneness on three different sub-systems written in9C++ with p-values 0.054, 0.0219 and 0.0602, and change in odds ratio 1.26, 1.45, and 1.26 [106]. A
study that evaluated WMC on a C++ application and a Java application found WMC to have a Spearman
correlation of 0.414 and 0.456 with the number of faults due to field failures respectively, and highly
significant p-values (<0.0001 and <0.0056) [10]. Another study using student systems found WMC to be10associated with fault-proneness with a p-value for the logistic regression coefficient of 0.0607 [4].
2.1.2.2 DIT
The Depth of Inheritance Tree [30] metric is defined as the length of the longest path from the class to the
root in the inheritance hierarchy. It is stated that as one goes further down the class hierarchy the more
complex a class becomes, and hence more fault-prone.
The DIT metric was empirically evaluated in [19][22]. In [19] the authors found that this metric was related
to fault-proneness (p=0.0074) with a change in odds ratio equal to 0.572 when measured on non-library
classes. The second study [22] also found it to be associated with fault-proneness (p=0.0001) with a
change in odds ratio of 2.311. Another study using student systems found DIT to be associated with fault-
proneness with a p-value for the logistic regression coefficient <0.0001 [4].
It will be noted that in the first study a negative association was found between DIT and fault-proneness.
The authors explain this by stating that in the system studied classes located deeper in the inheritance
hierarchy provide only implementations for a few specialized methods, and are therefore less likely to
contain faults than classes closer to the root [19]. This was a deliberate strategy to place as much
functionality as close as possible to the root of the inheritance tree. Note that for the latter two
investigations, the same data set was used, and therefore the slightly different coefficients may have
been due to removal of outliers.
One study using data from an industrial system found that classes involved in an inheritance structure
were more likely to have defects (found during integration testing and within 12 months post-delivery)
[27]. Another study did not find DIT to be associated with fault-proneness on three different sub-systems
written in C++, where faults were based on three years’ worth of trouble reports [106]. One study that
evaluated DIT on a Java application found that it had a Spearman correlation of 0.523 (p<0.0015) with the
number of faults due to field failures [10].
2.1.2.3 NOC
This is the Number of Children inheritance metric [30]. This metric counts the number of classes which
inherit from a particular class (i.e., the number of classes in the inheritance tree down from a class).
The NOC metric was empirically evaluated in [19][22]. In [19] the authors found that this metric was not
related to fault-proneness. Conversely, the second study [22] found it to be associated with fault-
proneness (p=0.0276) with a change in odds ratio of 0.322. Another study using student systems found8 Note that macros embodied in #ifdef’s are used to customize the implementation to a particular platform. Therefore, the method is
defined at design time but its implementation is conditional on environment variables. Not counting it, as suggested in [31], would
undercount methods known at design time.
In this study faults were classified as either object-oriented type faults or traditional faults. The values presented here are for all of
the faults, although the same metrics were found to be significanct for both all faults and the object-oriented only faults.
Furthermore, the change in odds ratio reported is based on a change of one unit of the metric rather than a change in the standard
deviation.
109 This study used the same data set as in [22], except that the data was divided into subsets using different criteria. The results
presented here are for all of the classes.
百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说教育文库The Confounding Effect of Class Size on The Validity of Obje(7)在线全文阅读。
相关推荐: