知识卡片
端口适配器反转依赖
端口与适配器架构让业务逻辑定义所需接口,基础设施实现这些接口;抽象端口由依赖注入或启动装配连接到具体适配器。这样业务规则不依赖数据库、云消息总线或界面框架,适合普通及事件溯源领域模型。应用层仍负责组织用例调用。
结构图:
flowchart TD
A[应用层:编排用例] --> B[业务逻辑与端口]
C[基础设施适配器] -->|实现端口,源码依赖指向业务| B
这张卡片看不懂?
这张卡片的反馈已满 10 条,暂时无法继续提交。
已有反馈 · 0 / 10 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- 架构模式 · 查看原书依据
Instead of referencing and calling the infrastructural components directly, the business logic layer defines “ports” that have to be implemented by the infrastructure layer. The infrastructure layer implements “adapters”: concrete implementations of the ports’ interfaces for working with different technologies (see Figure 8-11). Figure 8-11. Ports & adapters architecture The abstract ports are resolved into
参考来源
- 位置:《Learning Domain-Driven Design》第8章《架构模式》(来源项目:book-sources;源文件:extracted/Learning Domain-Driven Design/_epub-src/OEBPS/ch08.html)
- 结论依据:原文围绕本卡所述机制给出定义、适用条件及相关取舍,以下摘录为直接依据。
- 原始内容:Instead of referencing and calling the infrastructural components directly, the business logic layer defines “ports” that have to be implemented by the infrastructure layer. The infrastructure layer implements “adapters”: concrete implementations of the ports’ interfaces for working with different technologies (see Figure 8-11). Figure 8-11. Ports & adapters architecture The abstract ports are resolved into