知识卡片

普通读书笔记卡 · 3494

六边形架构隔离核心

理解等级:中级

六边形架构把业务能力放在核心,把 Web API、数据库等对外通信或存储机制视为适配器。核心与适配器分开后,替换数据库或入口形式时,业务规则可以保持稳定。关键检验是业务逻辑是否知道 HTTP、具体数据库等外层细节;若知道,边界尚未真正隔离。

这张卡片看不懂?

已有反馈 · 0 / 10 条

    还没有人提交反馈。

    原书出处

    参考来源

    - 位置:《Microservice APIs》第 7 章《Service implementation patterns for microservices》(源文件:_epub-src/OEBPS/Text/07.htm) - 结论依据:原文定义核心负责服务能力、外围适配器连接外部组件,并以 Web API 和数据库说明可替换的外部机制。 - 原始内容:the idea behind the hexagonal or ports-and-adapters architecture is that, in any application, there’s a core piece of logic that implements the capabilities of a service, and around that core we “attach” adapters that help the core communicate with external components. For example, a web API is an adapter that helps the core communicate with web clients over the internet.