知识卡片
契约工程避免库依赖
公开契约模块应保持简单、内聚且不依赖服务实现框架或内部共享库。传输对象只承载必要数据与业务语义;依赖越少,消费者越能按自己的技术栈独立演化。
这张卡片看不懂?
这张卡片的反馈已满 10 条,暂时无法继续提交。
已有反馈 · 0 / 10 条
还没有人提交反馈。
原书出处
参考来源
- 位置:《Principles of Software Architecture Modernization》第6章《Principles of Proper Services》(源文件:`_epub-src/OPS/ch06.xhtml`,归一化正文 [63274:67468))
- 结论依据:原文列出契约清晰、简单、精简和无二进制耦合等要求,并用仅依赖标准 Java 类型的接口示例说明。
- 原始内容:The contract must have properties like: Clean: No implementation details leak to consumers. Simple: Easy to understand by consumers. Bare: Does not have dozens and hundreds of operations. Lean: Does not have external dependencies besides the local objects defined in the project. No binary coupling: No imports besides the standard Java JDK.