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维的模型。基于多数投票策略的集成分类器可进一步提升性能,超越单个分类器。最后,面向开发者的在线调查表明,本文方法识别的违规症状具有实际价值,能为即将发生的架构侵蚀提供早期预警。