Adapters and Infrasctructure

247 views
Skip to first unread message

Erandir Junior

unread,
Mar 3, 2021, 10:51:56 PM3/3/21
to Clean Code Discussion
I have difficulty understanding some things related to clean architecture, such as the connection between the infrastructure layer and that of the adapters, as I see a certain dependency on use between them, correct me if I'm wrong:
Can my controllers depend on a route lib interface for example?
Can my gateways use something directly from orm, or do I need to create an interface for orm as well?

I see that decoupling is something that would take some work, at least in the cases above.
If you have examples of code and projects that implement clean architecture correctly, I would be very grateful to see them.

Paul Michael Reilly

unread,
Mar 3, 2021, 11:09:52 PM3/3/21
to clean-code...@googlegroups.com
Erandir, you might get better results if you post your question to the #clean-code-discsussion channel on the Clean Coders Slack workspace. Here's an invitation.

-pmr


--
The only way to go fast is to go well.
---
You received this message because you are subscribed to the Google Groups "Clean Code Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clean-code-discu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/clean-code-discussion/99c3cb0a-d0fa-47d6-a99a-0789905860d1n%40googlegroups.com.

Romain LAGARDETTE

unread,
Mar 4, 2021, 2:25:35 AM3/4/21
to clean-code...@googlegroups.com

Łukasz Duda

unread,
Mar 4, 2021, 3:35:57 AM3/4/21
to Clean Code Discussion
In my implementation of clean architecture I've noticed the following:
Regards
Łukasz

Erandir Junior

unread,
Mar 4, 2021, 9:12:35 AM3/4/21
to clean-code...@googlegroups.com
I could not access



--
Atenciosamente,

Antonio Erandir Feitosa Soares Junior
(85) 98112-7588

Erandir Junior

unread,
Mar 4, 2021, 9:12:35 AM3/4/21
to Clean Code Discussion
But wouldn't that violate the dependency rule?
Because in this case you are using an outer layer feature, directly on an inner layer.

Łukasz Duda

unread,
Mar 4, 2021, 9:30:09 AM3/4/21
to Clean Code Discussion
I don't think so. That's the role of adapter. Adapter depends on each side and nobody depends on adapter.
Of course if you look at the picture of dependencies https://blog.cleancoder.com/uncle-bob/2012/08/13/the-clean-architecture.html it seems like DB depends on Gateways and Web depends on controllers. Probably the picture is gently misleading in this regard.

Erandir Junior

unread,
Mar 4, 2021, 11:23:44 AM3/4/21
to Clean Code Discussion

I just made an image showing the flow in both cases, first creating abstractions and the second using external components directly from the adapters layer.
https://drive.google.com/file/d/1-G7GJzisWMGqVG8tHm6WElhvmyrLSPTs/view?usp=sharing

Erandir Junior

unread,
Mar 4, 2021, 11:23:44 AM3/4/21
to Clean Code Discussion
So, this is my biggest question about this, how far can I faithfully follow the image proposed by uncle Bob, creating abstractions even for external components? Use external components directly in adapters?

And your answer makes a certain sense, yes, I would even like to see an answer from Robert C. Martin, agreeing or refuting your point of view.
Em quinta-feira, 4 de março de 2021 às 11:30:09 UTC-3, lukasz....@gmail.com escreveu:
Reply all
Reply to author
Forward
0 new messages