知识卡片
存储与外部表示分离
内部数据模型、对象模型、资源模型、外部表示模型不是同一东西。API出现user与job-status资源,不说明后端必然有同名表;稳定的是外部属性与读写承诺。将内外模型映射隔离,才能更换文件、数据库或消息存储而不迫使客户端跟随变更。
这张卡片看不懂?
这张卡片的反馈已满 10 条,暂时无法继续提交。
已有反馈 · 0 / 10 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- 用超媒体思考与设计 · 查看原书依据
The data model you are using on the inside—that is, the names and locations of data properties, their grouping into tables, collections, etc.—should remain independent of the model you are using for document-style messages on the outside. This helps maintain a loose coupling between storage and interface details, which can lead to a more reliable and stable experience for both API consumers and producers.
参考来源
- 位置:《RESTful Web API Patterns and Practices Cookbook Connecting and Orchestrating Microservices and Distributed Data (Mike Amundsen)》第02章《用超媒体思考与设计》(来源项目 book-sources;源文件:extracted/RESTful Web API Patterns and Practices Cookbook Connecting and Orchestrating Microservices and Distributed Data (Mike Amundsen)/_epub-src/OEBPS/ch02.xhtml;小节:分布式数据)
- 结论依据:原文以内部数据模型、对象模型、资源模型、外部表示模型不是同一东西的机制或场景为依据;同小节余文补充本卡所列条件,按2022年原书语境整理。
- 原始内容:The data model you are using on the inside—that is, the names and locations of data properties, their grouping into tables, collections, etc.—should remain independent of the model you are using for document-style messages on the outside. This helps maintain a loose coupling between storage and interface details, which can lead to a more reliable and stable experience for both API consumers and producers.