trying to figure out some concepts and haven't been able to understand
What is a use-case in the Ports and Adapters architecture ?
What an implementation of a use-case would look like ?
What is a use-case concern ?
Where does it fit in the Infrastructure or Domain, it says it goes in the Application, well there is the Application Core and the Application Service which from my understanding are different ?
On the left side, the adapter depends on the port and gets injected a concrete implementation of the port, which contains the use case. On this side, both the port and its concrete implementation (the use case) belong inside the application;
https://herbertograca.com/2017/09/14/ports-adapters-architecture/#what-is-a-port
This quote confuses me ... because from what I understand a Primary Adapter can be anything that is asking for your business logic (it is interested in what you provide) WebAPI, MVC, Testing, ConsoleApp.
On the left side, the adapter depends on the port and gets injected a concrete implementation of the port which contains the use case.
So I assume that it refers to your business logic being injected in let;s say a WebApiController Constructor
On this side, both the port and its concrete implementation (the use case) belong inside the application;
So what ? who is this
application
Is it the WebApi ? or is the Domain ? also the use-case from what I understand is the implementation of my business logic, so for example the design would be something like this ?
Client :
WebApiController(IMyBusinessServicePort service)
Infrastructure :
ImplementingPrimaryAdapter : IMyBusinessServicePort { }
ImplementingSecondaryAdapter : ILoggingPort { }
Domain :
ImplementMyBusinessLogicService : IMyBusinessLogicService
So WebApiController will use the implementation provided by ImplementingPrimaryAdapter and not something from my domain ? I don;t understand
please explain .
Hexagonal architecture doesn't say anything about the internal structure of the hexagon.
The use cases fit like this:
Driver ports are the use case boundary of the application (the hexagon). A use case interface would be a driver port. The implementation of the use case would be a class inside the hexagon.
What Alistair call application is not the DDD application layer, is the business logic as a whole, the hexagon, decoupled from technology. If you want a comparison with DDD layers, the hexagon would have to be splitted in two layers: application and domain. The ddd infrastructure layer would be the adapters outside the hexagon.
But hexagonal architecture doesn't say anything about DDD, they are different things. It's up to you how to fit DDD with hexagonal architecture.
I have written an article about hexagonal architecture, if you want to fix the concepts:
https://jmgarridopaz.github.io/content/hexagonalarchitecture.html
Hope it helps.