知识卡片

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

知识级配置变化仍要处理历史对象

理解等级:高级

知识级的间接性会增加理解成本。若规则本身过于复杂,配置者可能需要近乎程序员的技能,错误配置会使业务行为出错。规则变更也不会自动解决数据迁移:应谨慎分析既有操作级对象在新旧规则下如何处理,可能允许两套规则并存,也可能需要转换。

因此只在可配置性确实重要且会扭曲普通模型的地方使用,并设计可理解、可校验的约束。

这张卡片看不懂?

已有反馈 · 0 / 10 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    • 原书第16章|Knowledge Level · 查看原书依据

      Like all powerful ideas, REFLECTION and KNOWLEDGE LEVELS can be intoxicating. This pattern should be used sparingly. It can unravel complexity by freeing operations objects from the need to be jacks-of-all-trades, but the indirection it introduces does add some of that obscurity back in. If the KNOWLEDGE LEVEL becomes complex, the system's behavior becomes hard to understand for developers and users alike. The users (or superuser) who configure it will end up needing the skills of a programmer—and a meta-level programmer at that. If they make mistakes, the application will behave incorrectly. Also, the basic problems of data migration don't completely disappear. When a structure in the KNOWLEDGE LEVEL is changed, existing operations-level objects have to be dealt with. It may be possible for old and new to coexist, but one way or another, careful analysis is needed.

    参考来源

    - 位置:《Domain-Driven Design: Tackling Complexity in the Heart of Software》第131章《Knowledge Level》(源文件:_epub-src/0321125215_ch16lev1sec4.html) - 结论依据:原文提醒知识级应节制使用,详细列出复杂配置、错误行为及旧对象迁移问题。 - 原始内容:Like all powerful ideas, REFLECTION and KNOWLEDGE LEVELS can be intoxicating. This pattern should be used sparingly. It can unravel complexity by freeing operations objects from the need to be jacks-of-all-trades, but the indirection it introduces does add some of that obscurity back in. If the KNOWLEDGE LEVEL becomes complex, the system's behavior becomes hard to understand for developers and users alike. The users (or superuser) who configure it will end up needing the skills of a programmer—and a meta-level programmer at that. If they make mistakes, the application will behave incorrectly. Also, the basic problems of data migration don't completely disappear. When a structure in the KNOWLEDGE LEVEL is changed, existing operations-level objects have to be dealt with. It may be possible for old and new to coexist, but one way or another, careful analysis is needed. - 转录说明:错误配置与数据迁移两句位于相邻段落,中间没有省去原文;`—` 为原 EPUB 中的异常破折号字节,原样保留并标识。