知识卡片
新增端点要守住服务内聚
在已有服务上新增独立端点,通常比让两个服务共享数据库更简单,也能避免把大文件塞进原有小响应。但若新功能不属于该服务的职责,端点仍会损伤内聚并增加耦合;应比较短期成本与后续迁移。
这张卡片看不懂?
这张卡片的反馈已满 10 条,暂时无法继续提交。
已有反馈 · 0 / 10 条
还没有人提交反馈。
原书出处
参考来源
- 位置:《Principles of Software Architecture Modernization》第2章《Anti-Patterns: Lack of Isolation》(源文件:`_epub-src/OPS/ch02.xhtml`,归一化正文 [12568:16927))
- 结论依据:原文比较独立报告端点与在用户资料响应中混入 PDF 的方案,并指出端点增加可能破坏服务职责的凝聚性。
- 原始内容:Adding a new endpoint to the profile service is the simplest solution, and does not create database isolation issues or hidden contracts. The separate endpoint will have no problem returning a binary PDF and not bloat the initial profile service call.