知识卡片
端口定义技术无关接口
端口是业务核心与适配器之间的技术无关接口,表达业务需要的操作,而不暴露 HTTP、SQL 或存储引擎细节。适配器负责把外部协议或存储能力转换为端口所需的形式。这样才能兑现 [[六边形架构隔离核心]] 的可替换性。
这张卡片看不懂?
这张卡片的反馈已满 10 条,暂时无法继续提交。
已有反馈 · 0 / 10 条
还没有人提交反馈。
原书出处
参考来源
- 位置:《Microservice APIs》第 7 章《Service implementation patterns for microservices》(源文件:_epub-src/OEBPS/Text/07.htm)
- 结论依据:原文要求将核心逻辑与适配器逻辑严格分开,并直接定义端口是连接两者的技术无关接口。
- 原始内容:Hexagonal architecture requires that we keep the core logic of the service and the logic for the adapters strictly separated. ... Ports are technology-agnostic interfaces that connect the business layer with the adapters.