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 automated 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 and semi-structured interviews 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, the findings derived from the online survey and interviews conducted with the involved developers reveal 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维模型的分类器。基于多数投票策略的集成分类器可进一步提升性能,且优于单个分类器。最后,通过对相关开发者进行的在线调查和访谈结果发现,我们的方法识别的违规症状具有实用价值,能够为即将发生的架构侵蚀提供早期预警。