Questions tagged [hexagonal-architecture]

The hexagonal architecture, also called ports and adapters architecture, aims at designing flexible component based architectures by decoupling the inner application core from the outside world by the mean of ports and adapters.

The hexagonal architecture is a pattern that aims at creating loosely coupled application components that can be easily connected to their software environment by means of ports and adapters.

This architecture makes components exchangeable by decouplings the inner application core from the outside world by using ports that define an API. Adapters make the glue between the software and its environment using the API. It is therefore also called ports and adapters architecture.

Ports define for example the API to be used the user interface and the database. Adapters can then connect the application to a test suite instead of a user interface, or connect the application to a different database.

External links:

39 questions
29
votes
5 answers

I can't really tell the difference between Hexagonal and Layered Architecture

So, in the hexagonal architecture layer, the application layer has incoming ports (use cases) that are called from incoming adapters, implemented by services, that use outcoming ports that are implemented by outgoing adapters. Is it really different…
codemonkey
  • 401
  • 1
  • 4
  • 7
10
votes
2 answers

In Hexagonal Architecture, can a UseCase call another UseCase?

My layers are like: Controller (Http) -> Use Case -> Domain Services Imagine that I have a PurchaseController which is just getting the parameters from the Http Request and calling the PurchaseUseCase. This PurchaseUseCase is using some domain…
9
votes
3 answers

How does Hexagonal architecture solve N-tier's service spagetti?

I've seen a couple of talks on Hexagonal architecture where they illustrate problems with N-tier architecture. Specifically, they show a spaghetti of service layer dependencies as the software grows. For example, the image below is from the…
nogridbag
  • 209
  • 1
  • 3
8
votes
4 answers

Hexagonal Architecture: What is the purpose of the input ports?

Pretty simple question, but googling brought me nowhere: What is the purpose of input ports in the hexagonal architecture? We are doing Java and seem to have some misunderstandings regarding the input part of this pattern. We presume: Domain Core /…
shadowhorst
  • 191
  • 4
8
votes
1 answer

Need explanation of hexagonal architecture

I am reading about Alistair Cockburn's Hexagonal Architecture with interest. One claim he makes is: Finally, the automated function regression tests detect any violation of the promise to keep business logic out of the presentation layer. The…
Victor Grazi
  • 241
  • 2
  • 8
6
votes
1 answer

How to achieve both: clean (hexagonal) architecture with JPA goodies?

How do I achieve two things at the same time writing Java Spring Application: Clean Architecture JPA goodies (@Transactional, Optimistic Locking, dirty checking, etc.) I like the idea of database/ORM framework being an unimportant detail that can…
5
votes
1 answer

How to handle the Dependencies between Secondary Actor Adapters in the Hexagonal Architecture

I am applying the principles of Hexagonal Architecture (Ports and Adapters) and one aspect is slightly bothering me. In my opinion, the ports and adapters of the secondary actors should completely be isolated from each other. No dependencies between…
5
votes
1 answer

Hexagonal architecture and translations: how to model it properly?

Imagine a backend service modeled by a hexagonal architecture, where the domain has a class modeling, let us say, a Step of a creative flow that a mobile app will use: class Step( val stepId: String, val description: String ) The…
5
votes
2 answers

Dependencies within the inner hexagon of Ports and Adapters

In this article Mark Seemann explains how Onion/Hexagonal Architecture (or Ports and Adapters) are somewhat similar to a layered architecture when the Dependency Inversion Principle (DIP) is applied. Especially if you consider the claims made in…
4
votes
1 answer

Is an Event Subscriber an Application Service, an Infrastructure Adapter, or something else?

I have two separate, isolated Domain-Driven Design contexts, and have a feature that needs to be implemented to integrate them together in some way. Both of these are broken down in a Hexagonal/Ports and Adapters style. The feature is implemented…
Zymus
  • 2,403
  • 3
  • 19
  • 35
4
votes
2 answers

Hexagonal/Clean Architecture - threads, locks, synchronization

All the examples across the internet try to pretend that every application is run on a single thread. There is no problem with synchronization, multithreading etc. Uncle Bob, in his "Clean Architecture" book mentions the topic but very briefly and…
4
votes
3 answers

How does an hexagonal architecture help with async/await async-over-sync?

In his book "Concurrency in C# Cookbook", Stephen Cleary writes: If you can, try to organize your code along modern design guidelines, like Ports and Adapters (Hexagonal Architecture), which separate your business logic from side effects such as…
D.R.
  • 231
  • 1
  • 5
4
votes
2 answers

Can Time be a Primary Actor in the Hexagonal Architecture?

I really like the fundamental principles behind the Hexagonal Architecture (Ports and Adapters) and I have mostly applied it to my system/application. There is one thing that I wasn't able to completely grasp: The system needs to wake up and do…
Guven
  • 914
  • 5
  • 18
3
votes
1 answer

Is websocket connection a driving adapter or driven adapter in hexagonal architecture

I am creating an application using hexagonal architecture. The application uses WebSocket connections to communicate with some outside clients. Communication works in both ways. the client can send a WebSocket message which the application needs to…
3
votes
2 answers

Domain Driven Design Validation Logic

I am trying to implement DDD along with Hexagonal Architecture. One of the things that I am struggling with is validations. I had explored a lot of articles on where the validation should be but it seems there is no one way. I would like to find the…
1
2 3