Software design patterns are standard solutions to common problems in software design and architecture. Knowing that a particular module implements a design pattern is a shortcut to design comprehension. Manually detecting design patterns is a time consuming and challenging task; therefore, researchers have proposed automatic design patterns detection techniques to facilitate software developers. However, these techniques show low performance for certain design patterns. In this work, we introduce an approach that improves the performance over the state-of-the-art by using code features with machine learning classifiers to automatically train a design pattern detection. We create a semantic representation of source code from the code features and the call graph, and apply the Word2Vec algorithm on the semantic representation to construct the word-space geometric model of the Java source code. DPD_F then uses a Machine Learning approach trained using the word-space model and identifies software design patterns with 74% Precision and 71% Recall. Additionally, we have compared our results with two existing design pattern detection approaches namely FeatureMaps & MARPLE-DPD. Empirical results demonstrate that our approach outperforms the benchmark approaches by 30\% and 10\% respectively in terms of Precision. The runtime performance also supports its practical applicability.
翻译:软件设计模式是软件设计和架构中常见问题的标准解决方案。 知道某个模块使用设计模式是设计理解的捷径。 人工检测设计模式是一项耗时且具有挑战性的任务; 因此, 研究人员提议了自动设计模式检测技术, 以便利软件开发者。 然而, 这些技术显示某些设计模式的性能较低。 在这项工作中, 我们引入了一种方法, 通过使用机器学习分类器的代码特性来提高最新设计模式的性能, 从而自动培训设计模式检测。 我们从代码特征和调用图中创建了源代码的语义表达法, 并在语义表达法上应用了 Word2Vec 算法来构建 Java 源代码的词空间几何模型。 DPD_F 然后使用一种经过培训的机器学习方法, 并用74% 的精度和 71%的回调来识别软件设计模式模式的性能。 此外, 我们将我们的结果与两种现有的设计模式检测方法进行了比较, 即, 自然地马斯和MARPLE- DPD。 Epricalalalal 显示我们的方法在实际操作上分别支持了30 和10 的可适用性。