知识卡片
BFF聚合不宜承载共享规则
BFF 适合由前端团队快速组织单一界面所需的数据;若聚合规则被多个服务或 API 共用,规则留在 BFF 会形成重复实现和难以复用的边界。应把共享业务规则放在更合适的服务契约下。
这张卡片看不懂?
这张卡片的反馈已满 10 条,暂时无法继续提交。
已有反馈 · 0 / 10 条
还没有人提交反馈。
原书出处
参考来源
- 位置:《Principles of Software Architecture Modernization》第2章《Anti-Patterns: Lack of Isolation》(源文件:`_epub-src/OPS/ch02.xhtml`,归一化正文 [58822:63009))
- 结论依据:原文说 BFF 让前端快速实现聚合,但其他服务或 API 也需要该聚合时会陷入困难,并需反复编写。
- 原始内容:BFF: As we mentioned before, the most common way to push complexity upwards is by moving business logic and aggregation to the BFF. In fact, it is great because JavaScript/TypeScript engineers like to keep things idiomatic and often are not big fans of Java, so they can quickly implement what they need without requiring a bunch of management sprint coordination and back and forth with backend engineers.