微前端反模式目录

A Catalog of Micro Frontends Anti-patterns

摘要 Abstract

微前端(Micro Frontend, MFE)架构因其促进独立性和模块化开发而广受欢迎。尽管其应用日益广泛,但该领域仍相对未被充分探索,尤其是在识别问题和记录最佳实践方面。本文基于已确立的微服务(Micro Service, MS)反模式以及对采用MFE的软件开发团队所面临的真实问题的分析,提出了一个包含12个MFE反模式的目录。我们通过识别MS反模式与MFE项目中反复出现的问题之间的相似性,将MS反模式映射并适应到MFE的上下文中,从而制定了目录的初始版本。为验证所识别的问题和提出的解决方案,我们对行业从业者进行了调查,收集了宝贵的反馈以完善反模式。此外,我们还询问参与者在实践中是否遇到这些问题,并让他们在10点李克特量表上评估其危害程度。调查结果显示,参与者在实际的MFE架构中遇到了所有提出的反模式,其中只有一个反模式的报告率低于50%。他们认为该目录可以成为新手和有经验的开发人员的宝贵指南,有助于提高MFE开发质量。收集的反馈促成了反模式目录的改进版本。此外,我们还开发了一个Web应用程序,不仅用于展示反模式,还积极促进MFE社区内的协作和参与。所提出的目录是识别和缓解MFE开发潜在问题的宝贵资源,使各级别的开发人员能够创建更健壮、可维护且设计良好的MFE应用程序。

Micro frontend (MFE) architectures have gained significant popularity for promoting independence and modularity in development. Despite their widespread adoption, the field remains relatively unexplored, especially concerning identifying problems and documenting best practices. Drawing on both established microservice (MS) anti-patterns and the analysis of real problems faced by software development teams that adopt MFE, this paper presents a catalog of 12 MFE anti-patterns. We composed an initial version of the catalog by recognizing parallels between MS anti-patterns and recurring issues in MFE projects to map and adapt MS anti-patterns to the context of MFE. To validate the identified problems and proposed solutions, we conducted a survey with industry practitioners, collecting valuable feedback to refine the anti-patterns. Additionally, we asked participants if they had encountered these problems in practice and to rate their harmfulness on a 10-point Likert scale. The survey results revealed that participants had encountered all the proposed anti-patterns in real-world MFE architectures, with only one reported by less than 50\% of participants. They stated that the catalog can serve as a valuable guide for both new and experienced developers, with the potential to enhance MFE development quality. The collected feedback led to the development of an improved version of the anti-patterns catalog. Furthermore, we developed a web application designed to not only showcase the anti-patterns but also to actively foster collaboration and engagement within the MFE community. The proposed catalog is a valuable resource for identifying and mitigating potential pitfalls in MFE development. It empowers developers of all experience levels to create more robust, maintainable, and well-designed MFE applications.