知识卡片
改造模式需记录未解妥协
模式可按业务改造,但要记录偏离和遗留问题。原书贷款案例中,过账金额总是原额,因此不需要 Fowler 原模式的 Method;Posting Rule 根据收入类型和资产类别选择账本名。
图11.10–11.11中的 Asset 知道账户是费用还是利息,并查找相应规则传入 Account。开发者选择它,是因为每次批处理都从数据重建对象,直接把规则连到 Account 会增加实例化时的协作;这是一项务实妥协。他们仍认为概念上规则只关联 Account、Asset 专注生成计提更清晰,期待后续重构。不能把当前实现讲成理想的最终模型。
这张卡片看不懂?
这张卡片的反馈已满 10 条,暂时无法继续提交。
已有反馈 · 0 / 10 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- 原书第11章|Example Insight into the Nightly Batch · 查看原书依据
They both felt that conceptually it would have been better to associate Posting Rules only with Accounts, while keeping the Asset focused on its job of generating Accruals. They hoped that subsequent refactorings and deeper insight would bring them back to this and show them a way to make this clean division without losing the obviousness of the code.
参考来源
- 位置:《Domain-Driven Design: Tackling Complexity in the Heart of Software》第85章《Example Insight into the Nightly Batch》(源文件:_epub-src/0321125215_ch11lev2sec2.html;单元03)
- 结论依据:对话说明删去Method和账本名选择;原文末段明确Asset中介是实例化约束下的务实决定,概念不适仍未解决。
- 原始内容:They both felt that conceptually it would have been better to associate Posting Rules only with Accounts , while keeping the Asset focused on its job of generating Accruals . They hoped that subsequent refactorings and deeper insight would bring them back to this and show them a way to make this clean division without losing the obviousness of the code.