You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: modules/ROOT/pages/architecture/hexagonale_architecture.adoc
+18-21Lines changed: 18 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,8 +13,6 @@ image::hexagonal_component_architecture_overview.drawio.svg["devonfw hexagonal a
13
13
// As the list is easier to maintain, try to do edits in the list structure, use the tool mentioned above and paste both in here:
14
14
15
15
// - application
16
-
// - config
17
-
// - Configuration.java
18
16
// - core
19
17
// - domain
20
18
// - Customer.java
@@ -59,8 +57,6 @@ image::hexagonal_component_architecture_overview.drawio.svg["devonfw hexagonal a
59
57
----
60
58
.
61
59
└── application/
62
-
├── config/
63
-
│ └── Configuration.java
64
60
├── core/
65
61
│ ├── domain/
66
62
│ │ ├── Customer.java
@@ -108,7 +104,7 @@ image::hexagonal_component_architecture_overview.drawio.svg["devonfw hexagonal a
108
104
| The core contains the essential business logic, domain entities, and use cases. It focuses on implementing the main functionalities while remaining technology-agnostic. The core interacts with external components through well-defined interfaces called "ports," ensuring a clear separation of concerns and promoting flexibility, testability, and maintainability.
109
105
110
106
| core.domain
111
-
| The domain circle contains the entities and value objects of the business domain of the application.
107
+
| The domain package contains the entities and value objects of the business domain of the application.
112
108
Related Factories or Builders are located here as well.
113
109
It's proposed to make entities anemic. See <<_anemic_vs_rich_domain_models>>
114
110
@@ -122,30 +118,30 @@ Depending of the size and adjacency of the use cases a grouping might make sense
122
118
| Ports are interfaces, that are used by the core and should be implemented by an according adapter.
123
119
Ports should not be technology specific.
124
120
One big advantage of the hexagonal architecture is, that the adapters can be changed without changing the core and therefore, without touching the business logic.
125
-
It needs to be distinguished between inbound ports and outbound ports.
121
+
It needs to be distinguished between incoming ports and outgoing ports.
126
122
127
123
| core.port.in
128
-
| Inbound ports are the entry of the application.
129
-
They provide interfaces that are called from inbound adapters and hide the actual implementation.
130
-
A proposal of structuring inbound ports is naming them like single use cases (e.g. CancelReservationPort).
124
+
| Incoming ports are the entry of the application.
125
+
They provide interfaces that are called from incoming adapters and hide the actual implementation.
126
+
A proposal of structuring incoming ports is naming them like single use cases (e.g. CancelReservationPort).
131
127
Each port should only provide a single method.
132
128
.Design Decision
133
129
[%collapsible]
134
130
====
135
-
Inbound Ports are not as relevant for the hexagonal architecture as the outbound ports.
136
-
Outbound ports are used for the dependency inversion pattern.
137
-
For inbound ports could also call the use cases directly.
138
-
Therefore, an pragmatic alternative would be leaving out the inbound ports.
131
+
Incoming Ports are not as relevant for the hexagonal architecture as the outgoing ports.
132
+
Outgoing ports are used for the dependency inversion pattern.
133
+
For incoming ports could also call the use cases directly.
134
+
Therefore, an pragmatic alternative would be leaving out the incoming ports.
139
135
140
-
It was decided to include the inbound ports nonetheless. They should implement single use cases that are offered.
136
+
It was decided to include the incoming ports nonetheless. They should implement single use cases that are offered.
141
137
Each interface should clearly mark the use case that contains only one method.
142
138
Use cases from the interface might be grouped logically in the use case implementation class.
143
139
====
144
140
145
141
| core.port.out
146
-
| Outbound ports decouple the interaction with external systems.
142
+
| Outgoing ports are an abstraction of everything in the surrounding context that is actively triggered by the core or used as data sink.
147
143
This might include other services that are called, files that are written, databases, event streaming and everything the application is actively triggering outside of the core.
148
-
Outbound ports should describe the business need for the communication (e.g. StoreReservationPort). How this is then realized depends on the adapter that implements it.
144
+
Outgoing ports should describe the business need for the communication (e.g. StoreReservationPort). How this is then realized depends on the adapter that implements it.
149
145
This way a technology can be easily replaced.
150
146
For example storing the reservation could be be realized in a first prototype by writing the objects to a file.
151
147
Later it could be replaced with a database.
@@ -154,7 +150,8 @@ The core logic would be untouched by that.
154
150
| [optional] core.service
155
151
| Services can be considered as business helper classes.
156
152
They provide a reusable part of the applications business logic that is used by multiple use cases or that helps to structure the application in a logical way.
157
-
Services are optional as they can be used, when there's a real need. Usually a use case should contain the business logic.
153
+
Services are optional as they can be used, when there's a real need.
154
+
Usually a use case should contain the business logic.
158
155
159
156
| adapter
160
157
a| Adapters connect the application core to the surrounding context. They have the following tasks:
@@ -166,14 +163,14 @@ a| Adapters connect the application core to the surrounding context. They have t
166
163
* Log the interaction with the surrounding context
167
164
168
165
| adapter.in
169
-
| Inbound adapters specify connection points for everything that can trigger the business logic.
166
+
| Incoming adapters specify connection points for everything that can trigger the business logic.
170
167
That might be interfaces (HTML, RPC, etc), Message Consumers or schedulers for batch processing.
171
-
Inside the adapters further packages are differentiating the protocols that is used (e.g. `.rest`).
168
+
Inside the adapters further packages are differentiating the category of the adapter (e.g. `.web`).
172
169
173
170
| adapter.out
174
-
| Outbound adapters define outgoing connections where the application actively interacts with context outside.
171
+
| Outgoing adapters define outgoing connections where the application actively interacts with context outside.
175
172
That can be database connections, file operations, API calls, message producing and many more.
176
-
Inside the adapters further packages are differentiating the protocols that is used (e.g. `.jpa`).
173
+
Inside the adapters further packages are differentiating the category of the adapter (e.g. `.repository`).
0 commit comments