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
6
votes
3 answers

Domain Driven Design (DDD): Domain Event Handlers – Where to place them?

I am confused about where to handle domain events in an application that is based on the hexagonal architecture. I am talking about the bounded-context-internal domain events, and not about inter-context integration/application/public…
6
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…
6
votes
1 answer

Can hibernate business objects be used as entities in a clean architecture?

In our project we use classes generated by eclipse hibernate plugin for persistence. The generated classes have following structure. MyClass extends BaseMyClass //POJO's, that are refenced in the hbm files MyClassDAO extends BaseMyClassDAO //DAO…
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
  • 10,969
  • 20
  • 97
  • 194
5
votes
2 answers

What is actually the Domain Model in Ports and Adapters architecture?

As I was reading a lot lately regarding the Ports and Adapters architecture, I stumbled upon this piece of code as a part of an application that was build following the above mentioned architecture : package com.example.user.management; import…
mka
  • 91
  • 1
  • 1
  • 4
4
votes
5 answers

In Hexagonal architecture, can a service rely on another service, or is that tight coupling?

I am creating a banking application. Currently, there is one primary service, the transaction service. This service allows getting transactions by id, and creating transactions. In order to create a transaction, I first want to check if the…
Sheen
  • 586
  • 10
  • 22
4
votes
2 answers

Jpa Entity as Domain Model

As per recommended practices documented for DDD or Hexagonal architecture - The domain Model should be separate from the data model representations that are more tied with actual technology used( table/column names, joins, etc, JPA annotation). A…
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…
4
votes
1 answer

Hexagonal architecture/clean code: Problems implementing adaptor pattern

I'm currently writing a small console application on the Symfony 2 framework. I'm attempting to insulate the application from the framework (mainly as an exercise after hearing some interesting talks on hexagonal architecture/ports and adaptors,…
ChrisC
  • 2,461
  • 1
  • 16
  • 25
4
votes
1 answer

Rails: How do I make my rails project a Hexagonal rails project?

I attended a meetup yesterday on scaling Rails, and one topic was Hexagonal Rails. However, I've only been doing Rails for a year, and am really comfortable (maybe too comfortable) with the MVC structure, so I don't really understand what adapter…
bigpotato
  • 26,262
  • 56
  • 178
  • 334
3
votes
2 answers

Classes and packages encapsulation in an hexagonal architecture

I would like to know if in Java (JDK 17) there is a way to easily handle classes and packages encapsulation in an hexagonal architure. I would like to make unavailable classes present in an adapter to the domain. To illustrate my goal, say we have…
akuma8
  • 4,160
  • 5
  • 46
  • 82
3
votes
1 answer

Hexagonal Architecture, do I violate its principles by reusing code between usecases?

Hello and thank you for taking the time to read my question :) I have several usecases that need to download and upload files from and to s3. For that, I've created a port and an S3 adapter that I share between those usecases. Somehow I feel that…
3
votes
1 answer

Parameterized validations in the model with clean architecture

I am developing an application trying to follow the advice of hexagonal architecture and clean architecture. Dividing the application into layers: infrastructure, application, and model. All this keeping an eye on my imported packages and that there…
oscar
  • 1,636
  • 6
  • 31
  • 59
3
votes
1 answer

Typescript - Interfaces or classes for domain objects and DTO in Clean architecture?

I don't have much experience with Typescript nor implementing architecture patterns with it, but we are working in a project that we want to use Clean Architecture but I have the doubt of using class or interface for declaring DTO and Domain…
1
2
3
11 12