← 返回刚才阅读的位置

知识卡片

问题卡 · 1968.t.1.b

动作契约遮蔽内部流程

理解等级:中级

内部函数命名或执行步骤变化时,不应迫使消费者同步重写业务调用。

外部动作按业务用途设计,用超媒体表单描述名字、输入及调用细节;内部函数名和字段名由映射层翻译。例如外部givenName可写入内部fname,内部改名只需维护映射。

一个declineContract动作可以封装日志、客户、合同及外部信用机构等多个更新。客户端不必重现内部操作顺序,服务以后可增删步骤。但把多个步骤包成一个动作并不自动解决部分失败,仍需另行设计错误与恢复。

关联:[[外部模型独立设计]]。

这张卡片看不懂?

已有反馈 · 0 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    • 超媒体服务 · 查看原书依据

      Finally, some internal actions—especially ones involving complicated computations or processes—are best expressed in a more simplified way. A service (onboardingSvc) might need to contact multiple dependent services (userSvc, customerRelationsSvc, and accountSalesSvc) and pass data between them in order to complete a task. It is often better to express this externally as a single action (sendOnboardingData) instead of multiple dependent actions (see the following example for details).

    参考来源

    - 位置:《RESTful Web API Patterns and Practices Cookbook》第5章《Hypermedia Services》(来源项目book-sources:extracted/RESTful Web API Patterns and Practices Cookbook Connecting and Orchestrating Microservices and Distributed Data (Mike Amundsen)/_epub-src/OEBPS/ch05.xhtml,配方5.4) - 结论依据:原文以词汇映射和declineContract多步骤动作,说明外部动作可独立于内部函数及执行次序。 - 原始内容:Finally, some internal actions—especially ones involving complicated computations or processes—are best expressed in a more simplified way. A service (onboardingSvc) might need to contact multiple dependent services (userSvc, customerRelationsSvc, and accountSalesSvc) and pass data between them in order to complete a task. It is often better to express this externally as a single action (sendOnboardingData) instead of multiple dependent actions (see the following example for details).