知识卡片

普通读书笔记卡 · 3331.e

契约粒度跟随业务能力

理解等级:高级

税务接口若只围绕销售记录 ID 定义计算方法,便把税务规则与销售生命周期耦合。服务契约的粒度应先看完整业务能力和变化方向,再决定操作范围;单个看似精简的方法也可能是错误边界。

这张卡片看不懂?

已有反馈 · 0 / 10 条

    还没有人提交反馈。

    原书出处

    参考来源

    - 位置:《Principles of Software Architecture Modernization》第2章《Anti-Patterns: Lack of Isolation》(源文件:`_epub-src/OPS/ch02.xhtml`,归一化正文 [50347:54591)) - 结论依据:原文用 TaxProcessor 绑定 salesID 的例子说明该接口不只计算税务,还被迫理解销售生命周期,并指出应从更大的税务生命周期判断粒度。 - 原始内容:High cohesion and loose coupling: What happens if the Tax keeps changing? What if your company is global – every country has different ways of calculating taxes, can this interface keep up? Our contract focuses on sales tax, and as you can see in the definition is coupled specifically with a salesID . The contract is not exclusively focused on calculating taxes alone; it must understand the sales lifecycle as well.