知识卡片
过账规则显化跨账户派生
同一笔金融信息可能需要在多个账户中呈现。若输入账户新增条目时,要计算并写入输出账户的新条目,把这项依赖显式建成 Posting Rule:它读取输入 Entry,经计算 Method 得到金额,再向输出 Account 增加 Entry。
原书转述 Fowler 模式时,用薪资账户触发预估30%所得税预扣账户条目作教学例子;这不是后文贷款系统的实际规则。显式规则让跨账户派生逻辑可被命名、检查,也为讨论何时触发提供对象。
结构图:
flowchart LR
I[输入 Account 的新 Entry] --> R[Posting Rule]
R --> M[Method 计算派生金额]
M --> O[输出 Account 的新 Entry]
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 0 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- 原书第11章|Example Insight into the Nightly Batch · 查看原书依据
A posting rule is triggered by a new Entry in its "input" account. It then derives a new Entry (based on its own calculation Method) and inserts the new Entry into its "output" Account . In a payroll system, an Entry in a salary Account might trigger a Posting Rule that would calculate a 30 percent estimated income tax and insert it as an Entry in the tax with-holding Account.
参考来源
- 位置:《Domain-Driven Design: Tackling Complexity in the Heart of Software》第85章《Example Insight into the Nightly Batch》(源文件:_epub-src/0321125215_ch11lev2sec2.html;单元01)
- 结论依据:原文及图11.8给出输入Account、Posting Rule、Method和输出Account的关系;30%预扣是薪资例子。
- 原始内容:A posting rule is triggered by a new Entry in its "input" account. It then derives a new Entry (based on its own calculation Method ) and inserts the new Entry into its "output" Account . In a payroll system, an Entry in a salary Account might trigger a Posting Rule that would calculate a 30 percent estimated income tax and insert it as an Entry in the tax with-holding Account .