Questions tagged [hexagonal-architecture]

The Hexagonal Architecture is a software architecture proposed by Alistair Cockburn. It is also called Ports and Adapters. It is similar to the Onion Architecture proposed by Jeffrey Palermo.

Alistair Cockburn proposed the Hexagonal Architecture, also called Ports and Adapters. The architecture is similar to the Onion Arcitecture proposed by Jeffrey Palermo.

The fundamental motivation of the approach is to avoid layer-to-layer dependencies usually associated with the N-tier architecture approach. This is achieved by placing all infrastructure, including databases, outside the problem domain.

The problem domain is then completely independent of the required infrastructure (testing, databases, security, etc.). For example, this means that testing database accesses can be done thoroughly without a real database.

176 questions
63
votes
5 answers

Onion architecture compared to hexagonal

Is there any difference between them (onion | hexagonal), from my understanding they are just the same, they focus upon the domain which is at the core of the application and should be technology / framework agnostic. What are the differences…
43
votes
4 answers

Ports and adapters / hexagonal architecture - clarification of terms and implementation

After reading different sources about the Ports & Adapters architecture including Alistair Cockburn's original article I am still not sure about the definite meaning of the terms "port" and "adapter" - especially when it comes to mapping these…
lost
  • 1,449
  • 1
  • 13
  • 17
23
votes
5 answers

Should my Domain Exceptions be thrown from Application Layer?

I'm reading Vaughn Vernon Book - Implementing Domain Driven Design. There is an example of a Project Management Application. There are aggregates like BacklogItem, Sprint, etc. If I have BacklogItemNotFoundException defined in Domain layer. Should…
DmitriBodiu
  • 1,120
  • 1
  • 11
  • 22
16
votes
3 answers

hexagonal architecture with spring data

I'm going to start a new project to learn spring boot, spring data, and the hexagonal architecture. From my understanding the hexagonal architecture aims to separate the core or domain layer from the database operations (Infrastructure Layer). I…
Rafael
  • 555
  • 6
  • 19
14
votes
2 answers

Hexagonal architecture and microservices: how do they fit together?

I was wondering how the hexagonal architecture relates to microservices. Do the microservices all go into the core of the hexagon? Or does each microservice get a hexagonal architecture? Or is it both (fractal)?
Jonathan Aquino
  • 343
  • 2
  • 8
12
votes
3 answers

Factory methods vs inject framework in Python - what is cleaner?

What I usually do in my applications is that I create all my services/dao/repo/clients using factory methods class Service: def init(self, db): self._db = db @classmethod def from_env(cls): return…
11
votes
4 answers

Use case containing the presenter or returning data?

Considering the Clean Architecture definition, and especially the little flow diagram describing relationships between a controller, a use case interactor, and a presenter, I'm not sure if I correctly understand what the "Use Case Output Port"…
swahnee
  • 2,661
  • 2
  • 24
  • 34
9
votes
2 answers

DDD Process Managers: Are they part of business logic?

Several sources claim that process managers do not contain any business logic. A Microsoft article for example says this: You should not use a process manager to implement any business logic in your domain. Business logic belongs in the aggregate…
8
votes
2 answers

Layers in Hexagonal Architecture

I'm reading a lot about hexagonal architecture, but in all the examples that i'm looking, all folders and class ubication are different, and this looks a bit confusing to me. I've done a simple spring boot application with below folder structure.…
8
votes
2 answers

hexagonal architecture and transactions concept

I'm trying to get used to hexagonal architecture and can't get how to implement common practical problems, already realized with different approaches. I think my core problem is to understand level of responsibility extracted to adapter and…
recvfrom_ro
  • 87
  • 2
  • 5
7
votes
4 answers

Interface for use cases (application services)?

Should Use Cases or Application Services have interfaces and implementations when following a hexagonal architecture with ddd principles? For example, the use case "delete a video", should it have IDeteVideo (interface) and DeletVideoImpl…
Mr. Mars
  • 762
  • 1
  • 9
  • 39
7
votes
3 answers

DDD Ports and Adapters with Onion architecture, what goes where?

trying to figure out some concepts and haven't been able to understand What is a use-case in the Ports and Adapters architecture ? What an implementation of a use-case would look like ? What is a use-case concern ? Where does it fit in the…
7
votes
2 answers

Hexagonal architecture - a simple use case

I've been reading a lot a bout hexagonal architecture and I do get most of the concepts (well, I hope I do), I didn't find any example of that architecture use-case wise. Let's say that my application domain model is to make people drunk. The whole…
7
votes
1 answer

Framework and database adapter with Hexagonal Architecture and DCI pattern

I try to design a web based application in Ruby. I have developed a simple core application implementing DCI paradigm in hexagonal architecture without framework and database. There are small hexagons in core hexagon and adapters such as web,…
pegatron
  • 516
  • 4
  • 16
6
votes
3 answers

Where in Hexagonal Architecture do periodic background tasks fit?

I am working on a program in golang, which I am sructuring based on Hexagonal Architecture. I think I have my head wrapped mostly around the idea, but there is something I just can't figure out. The function of the program is to monitor multiple IP…
1
2 3
11 12