知识卡片
契约承载消费者预期
服务或库发布接口,就是向消费者承诺可调用的能力;稳定性要以消费者能否持续按原约定使用来判断。提供方即使重构内部实现,也应识别并维护这些外部预期。
这张卡片看不懂?
这张卡片的反馈已满 10 条,暂时无法继续提交。
已有反馈 · 0 / 10 条
还没有人提交反馈。
原书出处
参考来源
- 位置:《Principles of Software Architecture Modernization》第2章《Anti-Patterns: Lack of Isolation》(源文件:`_epub-src/OPS/ch02.xhtml`,归一化正文 [41963:46162))
- 结论依据:原文把契约定义为服务或库对外公布的能力,并明确说提供方须履行消费者预期、不破坏预期才有稳定软件。
- 原始内容:Contracts are the interfaces published by services or libraries to advertise their capabilities. Contracts create expectations from consumers that the contract provider needs to oblige. Creating and fulfilling great contracts are at the core of making usable software solutions, and not breaking consumer expectations is at the core of making stable software solutions.