

聊聊Ports and Adapters architecture - SegmentFault 思否
source link: https://segmentfault.com/a/1190000039413401
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

本文主要研究一下Ports and Adapters architecture
Ports and Adapters architecture
Ports and Adapters architecture,又叫Hexagonal architecture,其中ports层是六边形的边界,其中port又可以分为driver port及driven port,简单理解对应输入层及输出层;边界保护的是内部的app,其中app包括use cases或者叫做application services层以及domain层;adapter可以理解为将外部依赖进行适配,实现port层定义的接口
github.com/albertllousas/implementing-hexagonal-architecture
├── app
│ ├── domain
│ │ ├── Account.kt
│ │ ├── Ids.kt
│ │ ├── Transaction.kt
│ │ └── Transfer.kt
│ ├── port
│ │ ├── driven
│ │ │ ├── AccountBalanceChecker.kt
│ │ │ ├── AccountFinder.kt
│ │ │ └── Transactor.kt
│ │ └── driver
│ │ └── TransferMoney.kt
│ └── usecase
│ └── TransferMoneyUseCase.kt
└── infrastructure
├── adapter
│ ├── driven
│ │ ├── InMemoryAccounts.kt
│ │ └── InMemoryTransactions.kt
│ └── driver
│ └── ktor
│ └── TransferHttpRoutes.kt
└── config
├── ApplicationModule.kt
└── ApplicationRunner.kt
port层这里定义了driven及driver两大类的接口,然后adapter层对应driven及driver这两大类使用外部的服务进行实现;domain层定义了domain model以及相关领域方法;usecase或者是application service层则是编排
Ports and Adapters architecture,又叫Hexagonal architecture,其中ports层是六边形的边界,其中port又可以分为driver port及driven port,简单理解对应输入层及输出层;边界保护的是内部的app,其中app包括use cases或者叫做application services层以及domain层;adapter可以理解为将外部依赖进行适配,实现port层定义的接口。
Recommend
-
164
The Ports & Adapters Architecture (aka Hexagonal Architecture) was thought of by Alistair Cockburn and written down on his blog in 2005. This is how he defines its goal in one sentence: Allow an application to equally be driven by users, pro...
-
28
关注 Weex 开发进展的同学,可能会知道 Weex 前段时间发布了 v0.18.0 版本(release note),其中包含了一个叫 <recycle-list> 的组件,它是一个带有回收复用功能的列表容器,据说是有史以来最特别的组件,...
-
69
Java语言特性系列 Java5的新特性 Java6的新特性 Java7的新特性 Java8的新特性 Java9的新特性 Java10的新特性 Java11的新特性 序 本文主要讲述一下Java10的新特性 特性列表 286: Local-Variable Type Inference(重...
-
55
-
35
-
46
-
46
-
10
Layers, Onions, Ports, Adapters: it's all the same by Mark Seemann If you apply the Dependency Inversion Principle to Layered Architecture, you end up with Ports and Adapters. ...
-
7
Functional architecture is Ports and Adapters Functional architecture tends to fall into a pit of success that looks a lot like Ports and Adapters. In object-oriented architecture, we often struggle...
-
8
Ports-and-Adapters Architecture: The Patternby Burkhard Stubert2023/08/242023/08/24...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK