知识卡片
动作契约遮蔽内部流程
内部函数命名或执行步骤变化时,不应迫使消费者同步重写业务调用。
外部动作按业务用途设计,用超媒体表单描述名字、输入及调用细节;内部函数名和字段名由映射层翻译。例如外部givenName可写入内部fname,内部改名只需维护映射。
一个declineContract动作可以封装日志、客户、合同及外部信用机构等多个更新。客户端不必重现内部操作顺序,服务以后可增删步骤。但把多个步骤包成一个动作并不自动解决部分失败,仍需另行设计错误与恢复。
关联:[[外部模型独立设计]]。
这张卡片看不懂?
这张卡片的反馈已满 10 条,暂时无法继续提交。
已有反馈 · 0 / 10 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 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).