Fantastic video Gui! 👌, these brief clarifications are always great to understand the basics, thanks for sharing. And I agree that, as a general rule of thumb, I like the simplicity of Hexagonal Architecture. And I say this after having mainly applied CA in the projects I have worked so far.
For non complex applications I like using Vertical Slices (used N-Tier architecture before). For more complex I moved from Clean Architecture to Clean Architecture + Vertical Slices. From Clean Architecture I have Domain and Infrastructure layers. Application and Presentation layers I combine into Vertical Slices. Sometimes I can even combine Infrastructure layer into Vertical Slices too
I've been studying Hexagonal Architecture to solve problems in my current project, and its simplicity fits well with my case. I'm confused about organizing shared things between the projects, for example, the logging service. To brief, I have the core and an adapter to fetch data from an outside API. So I use a service to centralize the logs. I should log all requests and responses in the adapter and log errors that can occur in the core flow. In this scenario, where is the best local to implement the log? - Inside the core and exposes it to the adapter? - Outside the core and the adapter and reference it on both projects? - In a new adapter?
IMO for the logs you can just create a interface in the Core/Domain project and use where you want. More logs = more costs, so try use only when is necessary
@@JoaoVictorFerreira-xx1rq But if I create only an interface the adapter will be responsible to implements the log logic. So I will should inject the log library in the adapter.
@@diegofaria8187 exactly, this design pattern is called faced, is very useful when you would like to use a library but not create a wrong dependency in all your application, so you call it by your interface
Your code needs a port to the logging service if the logging service has IO. That is the code that needs to be on an adapter. That means you can have the core using the Port (interface) and the code that sends the logs somewhere is an adapter. Does that make sense?
If the logging service has any kind of logic, you can segregate the logic from the “writing” part. In that case, they will be in different places. One in the core, the other as an adapter
Fantastic video Gui! 👌, these brief clarifications are always great to understand the basics, thanks for sharing. And I agree that, as a general rule of thumb, I like the simplicity of Hexagonal Architecture.
And I say this after having mainly applied CA in the projects I have worked so far.
Thanks Xavier! We all have been there
For non complex applications I like using Vertical Slices (used N-Tier architecture before). For more complex I moved from Clean Architecture to Clean Architecture + Vertical Slices.
From Clean Architecture I have Domain and Infrastructure layers. Application and Presentation layers I combine into Vertical Slices. Sometimes I can even combine Infrastructure layer into Vertical Slices too
So you have slices only on the application core?
I've been studying Hexagonal Architecture to solve problems in my current project, and its simplicity fits well with my case.
I'm confused about organizing shared things between the projects, for example, the logging service.
To brief, I have the core and an adapter to fetch data from an outside API. So I use a service to centralize the logs.
I should log all requests and responses in the adapter and log errors that can occur in the core flow.
In this scenario, where is the best local to implement the log?
- Inside the core and exposes it to the adapter?
- Outside the core and the adapter and reference it on both projects?
- In a new adapter?
IMO for the logs you can just create a interface in the Core/Domain project and use where you want.
More logs = more costs, so try use only when is necessary
@@JoaoVictorFerreira-xx1rq But if I create only an interface the adapter will be responsible to implements the log logic. So I will should inject the log library in the adapter.
@@diegofaria8187 exactly, this design pattern is called faced, is very useful when you would like to use a library but not create a wrong dependency in all your application, so you call it by your interface
Your code needs a port to the logging service if the logging service has IO. That is the code that needs to be on an adapter. That means you can have the core using the Port (interface) and the code that sends the logs somewhere is an adapter.
Does that make sense?
If the logging service has any kind of logic, you can segregate the logic from the “writing” part. In that case, they will be in different places. One in the core, the other as an adapter
The 2 are not mutually exclusive.
Yes. As I said, CA is an expansion of HA.
@@gui.ferreira It is a horrible name. A stupid name. Why not good architecture? Better? Great? Perfect? etc.