知识卡片
稳健API减少兼容需求
兼容性不只是版本路由。设计接口时克制地产出符合约定的数据,并对可合理容忍的扩展保留余地,可减少因附加字段等变化造成的无谓破坏;更深的API语义设计则减少未来被迫改约的次数。宽容接收不意味着接受错误权限或忽略关键业务校验,尤其不能把Postel法则当成安全验证的替代。
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 0 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- 宏观架构中的微服务决策 · 查看原书依据
Finally, it is better to avoid the problem altogether. Using Postel’s law in design—“be conservative in what you do, be liberal in what you accept from others” (mentioned by Bryzek)—can improve chances of both forward and backward compatibility.
参考来源
- 位置:《Software Architecture and Decision-Making》第10章《Macro Architecture: Microservices Considerations》(来源项目:book-sources;源文件:extracted/Software Architecture and Decision-Making Leveraging Leadership, Technology, and Product Management to Build Great Products… (Srinath Perera)/_epub-src/ch10.xhtml)
- 结论依据:摘录说明兼容性不只是版本路由。其余条件结合本章相邻例子与取舍说明,数字示例不作当前性能承诺。
- 原始内容:Finally, it is better to avoid the problem altogether. Using Postel’s law in design—“be conservative in what you do, be liberal in what you accept from others” (mentioned by Bryzek)—can improve chances of both forward and backward compatibility.