知识卡片
按业务责任划分服务层次
服务所属层次由责任决定。原书以银行转账作说明:应用服务接收请求、调用领域服务、等待确认并决定通知;领域服务协调账户与账本执行借贷规则;基础设施服务按指示发送邮件或信件。余额是否低于阈值适合由账户对象判断;导出电子表格只处理文件格式,属应用服务。转账是银行业务术语且承载业务规则,所以属于领域服务,即使具体借贷由账户对象完成。
这张卡片看不懂?
这张卡片的反馈已满 10 条,暂时无法继续提交。
已有反馈 · 0 / 10 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- 原书第05章|Services · 查看原书依据
That banking application could be responsible for funds transfers. If a SERVICE were devised to make appropriate debits and credits for a funds transfer, that capability would belong in the domain layer.
参考来源
- 位置:《Domain-Driven Design: Tackling Complexity in the Heart of Software》第40章《原书第05章|Services》(源文件:_epub-src/0321125215_ch05lev1sec4.html)
- 结论依据:原文逐项区分通知、阈值判断、转账与文件导出,并用三层转账服务表说明各层职责;这些是设计说明而非实际银行运行结果。
- 原始内容:The application layer is responsible for ordering the notification. The domain layer is responsible for determining if a threshold was met ... That banking application could be responsible for funds transfers. If a SERVICE were devised to make appropriate debits and credits for a funds transfer, that capability would belong in the domain layer. ... if the banking application can convert and export our transactions into a spreadsheet file for us to analyze, that export is an application SERVICE .