Abstract:Design pattern detection plays an important role in understanding and maintaining software system. With the purpose of identifying variants of design pattern efficiently and improving the accuracy of design pattern detection, an approach of design pattern detection based on stacked generalization in combination with object-oriented software metrics and pattern micro-structures is proposed in this study. Applying some typical machine learning algorithms, the approach trains a metric classifier and a micro-structure classifier for each design pattern, after which a stacked classifier is further trained and constructed on the predictive values of the two classifiers and some related object modeling features. To evaluate the proposed approach, a prototype tool, namely OOSdpd, is developed to detect design pattern instances from Java bytecode files of a system. The experiments on several classic open source projects are carried out, such as JUnit etc., and the proposed approach is compared with two existing tools. Experiments prove the effectiveness of the proposed approach in terms of improving the accuracy and recall rate of design pattern detection.