← 返回刚才阅读的位置

知识卡片

普通读书笔记卡 · 4378.a.3

复制代码只适合稳定小块

理解等级:高级

把共享代码复制进每个服务可避免编译期共享依赖,也容许迁移时各自删减演化;代价是缺陷与规则变更必须逐处传播,容易语义漂移。只有几乎不变、很小的标记注解或工具代码才较适合。复杂业务逻辑的重复不能只凭“避免耦合”正当化;应先比较其他复用方式。

这张卡片看不懂?

已有反馈 · 0 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    • 复用模式 · 查看原书依据

      This technique should be approached with extreme caution for the obvious reason that if a bug is found in the code or an important change to the code is needed, it would be very difficult and time-consuming to update all services containing the replicated code.

    参考来源

    - 位置:《Software Architecture: The Hard Parts》第08章《复用模式》(来源项目:book-sources;源文件:extracted/Software Architecture The Hard Parts Modern Trade-Off Analyses for Distributed Architectures (Neal Ford, Mark Richards, Pramod Sadalage etc.)/_epub-src/OEBPS/ch08.xhtml) - 结论依据:所引连续原文给出本卡机制或取舍;条件与示例结合本节已读上下文解释。 - 原始内容:This technique should be approached with extreme caution for the obvious reason that if a bug is found in the code or an important change to the code is needed, it would be very difficult and time-consuming to update all services containing the replicated code.