Question about clean architecture
I read article about clean architecture (in microsoft docs) and I have question about validation. In the article said that Application layer must not have any dependencies from external libraries and frameworks. But I see examples projects on github which build within clean architecture and many projects use fluent validation library in Application layer. So I have confusion, if sense of this architecture make independence application (and domain) layers from frameworks - why people do this?
14 Replies
A good question. I am also interested to know the answer.
In theory, Application layer should only depend on the Domain layer.
But I see many people make Application layer also depend on third party libraries like
MediatR
and FluentValidation
.@corteZz-1 @ABOUT ME explains my gameplay I personally wouldn't recommend
clean architecture
where you have multiple layers
etc. Honestly it just complicates everything. I would recommend a feature based architecture
.Instead of having multiple projects. You would do something likes this:
In this case, everything that has to do with
Users
is grouped as a feature
. Let's say you also want to implement authentication
than you just create another group or feature
.
This way everything is grouped together, there is no need to spend 10 minutes trying to find a file
or class
etc.Where do you put the
Migrations
folder? In a separate project?ignore the red underline lol.
Let's say you have an entity that doesn't really belong to any
feature
. Just create a folder named Entities
and store that entity inside there.Where is the
Migrations
folder?The
Migrations
folder would go right in the main Directory
in this case the project.
I just cloned the project from github
. That's why I have the red-underlines. lolpublic repo?
Believe me, I have tried the
clean architecture
approach. It's not worth it.
Sadly not, it's a private project. If you need some more clearification I can maybe help you.this approach called vertical slice architecture, you can search on github
$vsa is what we usually link here
https://www.youtube.com/watch?v=T-EwN9UqRwE
https://codeopinion.com/restructuring-to-a-vertical-slice-architecture/
dotnet
YouTube
Vertical Slice Architecture: How Does it Compare to Clean Architect...
Is Vertical Slice Architecture the next big thing or just as cool new kid?
Enterprise software development requires you to choose the right architecture. This session with Luke Parker will provide a realistic dive into Vertical Slice Architecture (VSA) with .NET; showcasing the potential shift from Clean Architecture (CA) to VSA.
You will lear...
Derek Comartin
CodeOpinion
Restructuring to a Vertical Slice Architecture
What is Vertical Slice Architecture? It's about focusing and organizing code by features and capabilities, not technical concerns!