知识卡片

普通读书笔记卡 · 3333.f

共享契约包保持最小依赖

理解等级:高级

服务间共享契约定义时,基础契约包应尽可能只保留必要数据结构与协议,不引入框架、日志或持久化依赖。否则一次库升级会穿透所有消费者,公开契约变成组织级同步点。

这张卡片看不懂?

已有反馈 · 0 条

    还没有人提交反馈。

    原书出处

    参考来源

    - 位置:《Principles of Software Architecture Modernization》第3章《Anti-Patterns: Distributed Monoliths》(源文件:`_epub-src/OPS/ch03.xhtml`,归一化正文 [8285:12558)) - 结论依据:原文以基础契约包引入 Spring、Hibernate 等依赖说明全员迁移和版本同步风险,并建议契约代码尽量零框架零依赖。 - 原始内容:Contract code should be as naked as possible, ideally with zero frameworks and zero dependencies. Try to avoid exotic, language-specific data types, 3rd party open-source frameworks and libraries are fine in a service implementation, but they are a big NO in the service contract.