知识卡片
计提对象承载科目归属
原书假设投资系统的旧夜间脚本计算利息与费用,还决定各自记入哪个科目。重构后,资产按计提计划产生 Accrual 集合;每条计提带金额和目标科目,脚本只遍历并提交,付款另行处理。于是利息和费用共用计提表达,科目知识移入领域层,新种类可通过计划扩展。图示概括图9.7–9.8,不代表真实会计系统的完整结构或已实测收益。参见[[计提与收款是不同业务事实]]。
结构图:
classDiagram
class Asset
class AccrualSchedule
class Accrual {
amount
ledger
}
class Payment
Asset "1" --> "1..*" AccrualSchedule : 按规则产生
AccrualSchedule ..> Accrual : 生成
Asset --> Payment : 独立记录
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 0 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- 原书第09章|Digging Out Concepts · 查看原书依据
In the refactored application, the nightly batch script tells each Asset to calculateAccrualsThroughDate().
参考来源
- 位置:《Domain-Driven Design: Tackling Complexity in the Heart of Software》第69章《Digging Out Concepts》,Example Earning Interest the Hard Way,图9.7–9.8(源文件:_epub-src/0321125215_ch09lev1sec1.html)
- 结论依据:原文给出夜间脚本调用资产计算计提、按每条记录指示的科目过账,以及职责转移和去重效果。
- 原始内容:In the refactored application, the nightly batch script tells each Asset to calculateAccrualsThroughDate() . The return value is a collection of Accruals , each of whose amounts it posts to the indicated ledger. The new model has several advantages. The change Enriches the UBIQUITOUS LANGUAGE with the term "accrual" Decouples accrual from payment Moves domain knowledge (such as which ledger to post to) from the script and into the domain layer Brings fees and interest together in a way that fits the business and eliminates duplication in the code Provides a straightforward path for adding new variations of fees and interest as Accrual Schedules. (原 EPUB 为无句号的列表项,此处用空格连接转录,末尾句号为转录补标。)
- 情节与图示证据:案例起句为 `The next story is set in a hypothetical financial company that invests in commercial loans and other interest-bearing assets.`;旧脚本分别计算利息与费用,并把金额和指定 ledger 交给会计程序。图9.8 分列 `Accrual Schedule`、`Income Accrual`、`Payment`,此卡结构图合并计提类型,仅表达职责与科目归属。