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:

49 questions
36
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…
11
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
  • 229
  • 1
  • 4
11
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…
10
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 /…
9
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…
8
votes
2 answers

Key difference between Hexagonal Architecture vs Clean Architecture?

I am trying to improve the architecture for my React app project that has grown in size lately. I'm looking at Hexagonal architecture and Clean architecture, and I couldn't really see the difference between them. In Hexagonal, there are main…
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…
6
votes
3 answers

Hexagonal Architecture + Domain Driven Design. How to perform a correct implementation?

Currently, I am trying to implement these two architectures together with Java and Spring (although technology shouldn't matter I think). But I'm encountering problems getting them to work together. I understand that my application should have a…
5
votes
1 answer

What is the difference between Hexagonal Architecture and Anti Corruption Layer Pattern?

I tried searching the web but can't understand the difference/boundary between hexagonal(ports and adapter) architecture and ACL Pattern. While hexagonal architecture talks about creating ports(interfaces) and adapters(implementation), doesn't ACL…
5
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,533
5
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…
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
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.
  • 241
1
2 3 4