知识卡片

普通读书笔记卡 · 1971.o.1.b.4.d.1.c.3.c

技术分包勿拆散领域对象

理解等级:高级

框架按技术层强制分包时,若把同一领域对象的数据和行为拆到多个包,开发者必须在脑中重新拼接对象,代码就难以直接呈现模型。原书的历史 J2EE 项目把每个概念对象拆成四层,虽有技术上的分工理由,却使领域模块难以增加和重构,最终削弱了模型表达。评估这类约束时,要计算理解与演化成本,不能只看每层内部是否整齐。

这张卡片看不懂?

已有反馈 · 0 / 10 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    参考来源

    - 位置:《Domain-Driven Design: Tackling Complexity in the Heart of Software》第41章《原书第05章|Modules (a.k.a. Packages)》(源文件:_epub-src/0321125215_ch05lev1sec5.html) - 结论依据:原文先说明数据行为分离损害对象内聚,再以四层历史项目说明技术分包令模块重构昂贵、代码无法直观映射模型;这不是普遍量化结果。 - 原始内容:Some frameworks create tiers by spreading the responsibilities of a single domain object across multiple objects and then placing those objects in separate packages. ... But on top of all this, the framework required each tier to be in a separate set of packages, named according to a convention that identified the tier. ... The leverage that should have derived from MODEL-DRIVEN DESIGN was limited because the code did not transparently reveal the model and allow a developer to work with it.