Architecture erosion has a detrimental effect on maintenance and evolution, as the implementation drifts away from the intended architecture. To prevent this, development teams need to understand early enough the symptoms of erosion, and particularly violations of the intended architecture. One way to achieve this, is through the automatic identification of architecture violations from textual artifacts, and particularly code reviews. In this paper, we developed 15 machine learning-based and 4 deep learning-based classifiers with three pre-trained word embeddings to identify violation symptoms of architecture erosion from developer discussions in code reviews. Specifically, we looked at code review comments from four large open-source projects from the OpenStack (Nova and Neutron) and Qt (Qt Base and Qt Creator) communities. We then conducted a survey to acquire feedback from the involved participants who discussed architecture violations in code reviews, to validate the usefulness of our trained classifiers. The results show that the SVM classifier based on word2vec pre-trained word embedding performs the best with an F1-score of 0.779. In most cases, classifiers with the fastText pre-trained word embedding model can achieve relatively good performance. Furthermore, 200-dimensional pre-trained word embedding models outperform classifiers that use 100 and 300-dimensional models. In addition, an ensemble classifier based on the majority voting strategy can further enhance the classifier and outperforms the individual classifiers. Finally, an online survey of the involved developers reveals that the violation symptoms identified by our approaches have practical value and can provide early warnings for impending architecture erosion.
翻译:架构侵蚀对软件维护和演化具有破坏性影响,会导致实现与预期架构逐渐偏离。为防止此问题,开发团队需要尽早识别侵蚀症状,尤其是与预期架构的违规行为。实现这一目标的一种途径是通过文本制品(特别是代码评审)自动识别架构违规。本文基于三种预训练词向量,开发了15种基于机器学习的分类器和4种基于深度学习的分类器,用于从代码评审中的开发者讨论中识别架构侵蚀的违规症状。具体地,我们分析了来自OpenStack(Nova和Neutron)和Qt(Qt Base和Qt Creator)社区四个大型开源项目的代码评审评论。随后进行了一项调查,从参与代码评审中讨论架构违规的相关人员处获取反馈,以验证所训练分类器的实用性。结果表明,基于word2vec预训练词向量的SVM分类器性能最优,F1分数达0.779。在多数情况下,采用fastText预训练词向量模型的分类器能达到相对较好的性能。此外,200维预训练词向量模型的分类器优于使用100维和300维模型的分类器。进一步地,基于多数投票策略的集成分类器能进一步优化性能,超越单个分类器。最终,对参与开发者的在线调查表明,本方法识别的违规症状具有实际价值,可为即将发生的架构侵蚀提供早期预警。