知识卡片
深服务封装复杂逻辑
深模块用简单接口封装复杂实现;浅模块公开的操作与内部逻辑几乎等量,新增的边界反而增加移动部件。微服务也应以此衡量深度:接口越能隐藏本地复杂性,系统越易变更。继续拆过合适粒度后,协同接口重新变宽,变更成本反而回升;这比按固定代码量定尺寸更可靠。
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 0 条
还没有人提交反馈。
在整书笔记中的位置
- · 第14章 微服务
原书出处 · 1 处
- 微服务 · 查看原书依据
According to this model, effective modules are deep: a simple public interface encapsulates complex logic. Ineffective modules are shallow: a shallow module’s public interface encapsulates much less complexity than a deep module. Consider the method in the following listing: int AddTwoNumbers(int a, int b) { return a + b; } This is the extreme case
参考来源
- 位置:《Learning Domain-Driven Design》第14章《微服务》(来源项目:a19c7933-4eda-4176-aebd-30fe7e1ad292;源文件:extracted/Learning Domain-Driven Design/_epub-src/OEBPS/ch14.html)
- 结论依据:原文介绍Ousterhout的深模块矩形模型,并联系服务粒度、集成接口和变更成本。
- 原始内容:According to this model, effective modules are deep: a simple public interface encapsulates complex logic. Ineffective modules are shallow: a shallow module’s public interface encapsulates much less complexity than a deep module. Consider the method in the following listing: int AddTwoNumbers(int a, int b) { return a + b; } This is the extreme case