Clean Architecture vs Hexagonal Architecture: Which One Should You Choose for Microservices?

  Рет қаралды 2,070

Gui Ferreira

Gui Ferreira

Күн бұрын

Пікірлер: 12
@xaberue
@xaberue Ай бұрын
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.
@gui.ferreira
@gui.ferreira Ай бұрын
Thanks Xavier! We all have been there
@antonmartyniuk
@antonmartyniuk 2 ай бұрын
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
@gui.ferreira
@gui.ferreira Ай бұрын
So you have slices only on the application core?
@diegofaria8187
@diegofaria8187 2 ай бұрын
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?
@JoaoVictorFerreira-xx1rq
@JoaoVictorFerreira-xx1rq 2 ай бұрын
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
@diegofaria8187
@diegofaria8187 2 ай бұрын
@@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.
@JoaoVictorFerreira-xx1rq
@JoaoVictorFerreira-xx1rq 2 ай бұрын
@@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
@gui.ferreira
@gui.ferreira Ай бұрын
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?
@gui.ferreira
@gui.ferreira Ай бұрын
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
@rmcgraw7943
@rmcgraw7943 2 ай бұрын
The 2 are not mutually exclusive.
@gui.ferreira
@gui.ferreira Ай бұрын
Yes. As I said, CA is an expansion of HA.
How to Organize Your ASP.NET Program.cs File
15:40
Gui Ferreira
Рет қаралды 5 М.
REST, gRPC, or GraphQL: Which Should You Use?
13:17
Gui Ferreira
Рет қаралды 3 М.
I Turned My Mom into Anxiety Mode! 😆💥 #prank #familyfun #funny
00:32
Elza love to eat chiken🍗⚡ #dog #pets
00:17
ElzaDog
Рет қаралды 19 МЛН
Who's spending her birthday with Harley Quinn on halloween?#Harley Quinn #joker
01:00
Harley Quinn with the Joker
Рет қаралды 14 МЛН
Hexagonal Architecture (All You Need to Know)
9:51
Gui Ferreira
Рет қаралды 8 М.
Гексагональная архитектура и микросервисы #java #microservices #hexagonal
1:22:47
Уголок сельского джависта
Рет қаралды 9 М.
Why is Clean Architecture so Popular?
11:52
CodeOpinion
Рет қаралды 49 М.
Event Driven Architecture EXPLAINED in 15 Minutes
14:55
Continuous Delivery
Рет қаралды 35 М.
When do I throw an Exception or Return an Error
12:11
Gui Ferreira
Рет қаралды 3,8 М.
Which Software Architecture Should You Use: MVC, MVP, or MVVM?
24:27
Building better DTOs in C#
11:57
Gui Ferreira
Рет қаралды 6 М.