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.

95 questions
40
votes
4 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…
33
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,339
  • 1
  • 11
  • 17
14
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…
13
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
  • 513
  • 4
  • 17
10
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…
7
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)?
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
  • 496
  • 4
  • 15
6
votes
1 answer

N-Layer to Hexagonal (Ports and Adapters) architecture

Alistair Cockburn introduced a Hexagonal architecture, now it is called Ports and Adapters pattern. In my understanding, the concept is similar to n-layer architecture where one layer depends on the other layer via abstraction (interface) only. For…
wonderful world
  • 8,704
  • 14
  • 76
  • 142
5
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,151
  • 2
  • 18
  • 30
4
votes
2 answers

In onion, hexagonal, or clean architecture, can a domain model contain different properties than the domain model in the database?

I am asking you who know well and have experience in building a software using any layered architecture (onion, hexagonal, clean, etc.). Whenever I google about the software architecture, people have different perspectives and explain the same…
4
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
  • 522
  • 1
  • 5
  • 22
4
votes
1 answer

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…
4
votes
2 answers

Can a DDD repository be stateful?

I’m designing a shipping application and trying to use Clean Architecture. I’m trying to figure out where to hold state of a Shipment object so that I don’t have to re-instantiate a new object every time a user clicks on a button in the UI. Here…
4
votes
1 answer

Composition root in automated test of hexagonal application

I am developing an hexagonal application with BDD approach with Specflow (C# cucumber). I want to implement automated scenario system test running the core and injecting test double on the port of the inner hexagon instead of the production…
1
2 3 4 5 6 7