知识卡片
聚合命令守住不变量
聚合是一组共享一致性边界的实体和值对象。外部只能读状态,写入必须经过聚合公开的业务命令,由聚合检查规则再修改。应用层负责加载、调用、保存与返回结果,不在外部拼凑业务规则。这样可避免另一个入口直接改字段绕过不变量。
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 0 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- 应对复杂业务逻辑 · 查看原书依据
To enforce consistency of the data, the aggregate pattern draws a clear boundary between the aggregate and its outer scope: the aggregate is a consistency enforcement boundary. The aggregate’s logic has to validate all incoming modifications and ensure that the changes do not contradict its business rules. From an implementation perspective, the consistency is enforced
参考来源
- 位置:《Learning Domain-Driven Design》第6章《应对复杂业务逻辑》(来源项目:book-sources;源文件:extracted/Learning Domain-Driven Design/_epub-src/OEBPS/ch06.html)
- 结论依据:原文围绕本卡所述机制给出定义、适用条件及相关取舍,以下摘录为直接依据。
- 原始内容:To enforce consistency of the data, the aggregate pattern draws a clear boundary between the aggregate and its outer scope: the aggregate is a consistency enforcement boundary. The aggregate’s logic has to validate all incoming modifications and ensure that the changes do not contradict its business rules. From an implementation perspective, the consistency is enforced