← 返回起始笔记位置

知识卡片

普通读书笔记卡 · 1971.o.1.b.4.e.3.a.1.a

查询替代集合须核对访问模式

理解等级:中级

Delivery History 改用仓储查询并非普遍更快。原书给出的判断条件是:若事件写入频繁、只偶尔查最后一次装卸,定向查询可避免维护集合;若对象数据库擅长关联遍历,且经常列出完整历史,保留显式集合可能更好。对尚未提出的“某承运段载有哪些货物”查询,不宜提前承担实现代价。这些是原书货运案例的取舍推断,需用实际读写频率和存储技术验证。

这张卡片看不懂?

已有反馈 · 0 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    参考来源

    - 位置:《Domain-Driven Design: Tackling Complexity in the Heart of Software》第57章《原书第07章|Pause for Refactoring: An Alternative Design of the Cargo Aggregate》(源文件:_epub-src/0321125215_ch07lev1sec9.html) - 结论依据:原文把对象数据库关联遍历、完整历史列表频率和未请求功能作为反向约束;没有给出性能测量。 - 原始内容:On the other hand, if we are using an object database, traversing an association or an explicit collection is probably much faster than a REPOSITORY query. If the access pattern includes frequent listing of the full history, rather than the occasional targeted query of last position, the performance trade-off might favor the explicit collection.