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
0
votes
1 answer

How to create a custom Spring Boot @component - annotation to adhere clean-code/architecture principles?

I'd like to follow clean/hexagonal architecture and therefore I'd like to keep my services/interactors clean of any spring dependencies. Is it possible to replace the @Component annotation with a custom annotation and register it with spring, so my…
crushervx
  • 587
  • 1
  • 7
  • 18
0
votes
0 answers

Aggregate root id reference field naming convention

Let me assume that I have the 2 aggregates as below. data class Order( val id: OrderId, val shipmentIds: Set ) : BaseAggregate() {} data class Shipment( val id: ShipmentId, var fromAddress: ShippingAddress, var…
0
votes
1 answer

Saving a domain entity to a file

I have a domain entity with the saveToFile method. This method takes an implementation of the ToFileSavable interface. And now a few questions. What is this interface in DDD? Is it a port and its impementation are adapters? In what layers should…
0
votes
1 answer

Does an external service (Machine Learning Model Exposed trough an API) fit the DDD definition of a Repository?

The title was inspired by this question. Hello there! Im currently implementing an Hexagonal Architecture following DDD. In a usecase of the application, im using a sort of third service abstraction over an API that exposes a Machine Learning…
0
votes
0 answers

How properly handle generic parameters with Future functions?

We are implementing Hexagonal Architecture in our Flutter application. For authentication we created a interface which will be later inherited by the authentication repository. Two functions uses generic parameter: one is for social signup what can…
SalahAdDin
  • 2,023
  • 25
  • 51
0
votes
1 answer

Are Ports and Adapters supposed to abstract away the HTTP stack?

I am concerned about overengineering my code when thinking about Ports and Adapters architecture. Two very common examples of the system contacting with the outside world are my HTTP stack and local filesystem. These are clear situations when the…
SystematicFrank
  • 16,555
  • 7
  • 56
  • 102
0
votes
1 answer

Calling overwrite confirmation dialog from database

Background I have my app setup as hexagonal architecture, with the UI (App), Domain and Database (Room) as separate modules. Upon pressing a button in the UI, user input data is being saved in the room database. If the Room database throws a…
Olli
  • 375
  • 5
  • 15
0
votes
1 answer

Laravel not finding the controller located in other folder

I'm trying to implement a clean architecture in laravel, thus I'm moving my own code to a src folder. My controller is located in src\notebook\infrastructure but when i call it from routes\web.php this way: Route::get('/notebook',…
0
votes
1 answer

Need an opinion about abstractions and update process in a domain model

I have an Agenda that holds many Card, and a Card has multiple DetailItem that hold a value like Email, Phone and a Label So, I can do: agenda = new Agenda() oneCard = new Card() item = new DetailItem(new Email("x@y.z"), new…
0
votes
1 answer

DDD and helper classes

I create an application based on DDD and hexagonal architecture in conjunction with CQRS (without ES). I'm stuck. In one of the bounded contexts I have layers: Domain, Application, Infrastructure, Ui. I think this is a fairly common…
0
votes
1 answer

Calling repository from domain with interface Hexagonal Architecture

I need to know if an entity (User) matches given some criteria. I have defined the criterions in the domain and they implements an interface: match(User)bool Now the problem is one criterion needs the data of the other entity (Company), and User…
0
votes
1 answer

How to handle relationships in domain when they are part of the database normalization

You have Job *--1 Board, so in your database you will have a board_id in your jobs table. Now, in the domain, Job can live without Board. So thinking about adding a boardId property to it doesn't seam logical to me. Is it ok to manage it through the…
0
votes
1 answer

Which one of these two options is the best for implementing a port in the domain

I have a Document class which needs to be authorized externally before being saved to database. Is it ok to create an authorize method like ... class Document: authorize(IExternalAuthorizator authorizator): authorization_result =…
0
votes
2 answers

Where is the best layer (Presentation, Service, Domain, Repository) to set a image path url

I have a question for you. I have a .NetCore proyect with a hexagonal architecture. In my repository class I fill my domain class that its name is company and has two properties: Id and Logo. My repository returns de Id and the logo name, but not…
0
votes
1 answer

Confused on how to write a simulator

I am trying to follow the hexagonal design of ports and adapters and more specifically following this approach: https://learn.microsoft.com/en-us/archive/blogs/ericgu/unit-test-success-using-ports-adapters-simulatorskata-walkthrough and…
user2820906
  • 195
  • 1
  • 15