Clean Architecture vs Vertical Slices #shorts

preview_player
Показать описание
They are both about managing coupling but coupling to what is the difference.
#softwarearchitecture #softwaredesign
Рекомендации по теме
Комментарии
Автор

so clean architecture never says anything about domain separation, just about the technical layers. So a vertically sliced architecture can also implement clean architecture for each slice. If there was a venn diagram, there would be an overlap between the two styles.

devagr
Автор

"Vertical slices" is the name for how I've been writing code but now I have a name for it. Thanks!

TheBearmoth
Автор

Been seeing this stuff in my feed lately. Tried watching one video, really didn’t get it though. Are there any diagrams of this stuff? Simple examples. Sounds like SOLID stuff.

justingiovanetti
Автор

The "vs" is misleading. Use both.

1. You can do clean architecture first, then do vertical slicing.

2. Or you can do vertical slicing first, and within each slice a mini-clean-architecture.

Both valid. The rest is a matter of taste, team dynamics, previous experiences, etc.

Personally, I prefer 1. The reason is it allows for a more organic growth and learning from the requirements, as use cases come in. I can then shift gradually to either vertical slicing, microservices, or slicing first, then microservices - in case the need arises.

The reason why I can do that gradually is that all use cases are closer to each other, the whole business logic is more focused, and an analysis of how use cases are related is way more clear.

Let me emphasize that: 1 makes the analysis of the use cases easier.
Meaning also: identifying bounded contexts is way easier also (if you go DDD, identifying them is one of the difficult parts, so 1 makes that easier).

This being said, I won't shy away from vertical slicing, once the project is more settled (meaning: the business side and the tech side have reached maturity, not many fundamental things have been changing in the past 2 years, etc)

FlaviusAspra
Автор

I always start with DDD and then clean architecture when I can. DDD strictly following it and clean architecture just loosely following it. I can also incorporate CQS if I want to but not strictly like DDD.

enkindel
Автор

We can share some code between slices, right? I'm trying slice architecture in my projects and I split between two main folders: application and domain. In the domain I have entities, value objects, domain services, etc., which can be used by any slice (aka feature). In the application folder each file is a feature with all the code needed for it. Sometimes I have the same complex query that is used by two features, eg: a query that is used for retrieve data and for export in csv. For this I separate the query into a file and import in the two features. Thanks for the great content of the channel and for showing me this kind of architecture, I was trying something close to this, but didn't realize it existed. PS: sorry for my english haha

FernandoZabin