知识卡片
隐性契约须从使用处发现
服务公开 API 之外,共享表、文件、枚举以及库中意外公开的内部类,也可能被消费者当成契约。评估时应从实际使用处盘点这些隐性依赖,并补足契约测试。
这张卡片看不懂?
这张卡片的反馈已满 10 条,暂时无法继续提交。
已有反馈 · 0 / 10 条
还没有人提交反馈。
原书出处
参考来源
- 位置:《Principles of Software Architecture Modernization》第5章《Assessments》(源文件:`_epub-src/OPS/ch05.xhtml`,归一化正文 [41966:46104))
- 结论依据:原文列举内部共享库、直接访问服务数据库和共享对象文件等隐性契约形式。
- 原始内容:Acknowledging the public contract might be more difficult than it sounds because you can easily have hidden contracts. Some examples: Internal shared libraries : Imagine there is a class that is being called in the guts of the library that should not be accessed. In Java, people often make all classes public, creating opportunities for abuse from consumers.