← 返回刚才阅读的位置

知识卡片

普通读书笔记卡 · 1971.o.1.c.1.a.1.c.3.c.1

份额数学让交易读成规则

理解等级:高级

当份额计算集中在不可变 Share Pie,贷款交易可以写成业务等式。原书联贷设计示例中:

  • 本金付款分配 = 当前贷款份额按付款金额 prorated。
  • 付款后的贷款份额 = 当前份额 minus 付款份额。
  • 提款后的贷款份额 = 当前份额 plus 新提款份额。
  • 出借人偏离约定 = 实际份额 minus 融资承诺份额按贷款总额的理论分布。

这些表达复用了同一组计算函数,命令才负责替换状态。它们是原书展示的模型语义与示例代码,并未证明真实金融场景的金额精度或合规结果。

这张卡片看不懂?

已有反馈 · 0 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    • 原书第10章|Angles of Attack · 查看原书依据

      Each of these short methods states its meaning. Applying a principal payment means that you subtract the payment from the loan, share by share. Distributing a principal payment is done by dividing the amount pro rata among the shareholders. The design of the Share Pie has allowed us to use a declarative style in the Loan code, producing code that begins to read like a conceptual definition of the business transaction, rather than a calculation.

    参考来源

    - 位置:《Domain-Driven Design: Tackling Complexity in the Heart of Software》第82章《Angles of Attack》(源文件:_epub-src/0321125215_ch10lev1sec9.html;单元04) - 结论依据:原文把付款与提款等交易写成 Pie 的 prorated、minus、plus 组合,指出 Loan 方法开始像业务交易的概念定义而非计算过程。 - 原始内容:Each of these short methods states its meaning . Applying a principal payment means that you subtract the payment from the loan, share by share. Distributing a principal payment is done by dividing the amount pro rata among the shareholders. The design of the Share Pie has allowed us to use a declarative style in the Loan code, producing code that begins to read like a conceptual definition of the business transaction, rather than a calculation.