Vertical Slice Architecture Myths You Need To Know!

  Рет қаралды 11,349

CodeOpinion

CodeOpinion

Күн бұрын

As with anything that gains traction from a wider community, some misconceptions develop and spread. Vertical slice architecture falls into that trap. Don't worry. I've got you covered to demystify some common misconceptions and why they likely exist. Let's set the record straight.
🔗 EventStoreDB
eventsto.re/codeopinion
🔔 Subscribe: / @codeopinion
💥 Join this channel to get access to a private Discord Server and any source code in my videos.
🔥 Join via Patreon
/ codeopinion
✔️ Join via KZbin
/ @codeopinion
📝 Blog: codeopinion.com
👋 Twitter: / codeopinion
✨ LinkedIn: / dcomartin
📧 Weekly Updates: mailchi.mp/63c7a0b3ff38/codeo...

Пікірлер: 41
@CodeOpinion
@CodeOpinion 6 ай бұрын
Learn more about Software Architecture & Design by subscribing to my newsletter. 🚀mailchi.mp/63c7a0b3ff38/codeopinion
@marna_li
@marna_li 6 ай бұрын
Thank you! You are addressing many of my concerns. I see a lot of examples of VSA using CRUD. That is kind of lazy. If your Use Cases are CRUD then it is fine. But devs should not fall into the CRUD trap when building business apps.
@krccmsitp2884
@krccmsitp2884 6 ай бұрын
It always comes back to the fundamental, well-known principles of software architecture called (high) cohesion and (low) coupling, no matter whether you choose Vertical Slices, Hexagonal, Onion, or Clean Architecture, which are just different approaches.
@CodeOpinion
@CodeOpinion 6 ай бұрын
Agreed!
@Forshen
@Forshen Ай бұрын
I am a huge fan of Vertical Slice Architecture atm, so i love this video, every point you made was spot on.
@DiogoBaeder
@DiogoBaeder 6 ай бұрын
I love how you de-dogmatize stuff, man. Great video!
@ForgottenKnight1
@ForgottenKnight1 Ай бұрын
2:02 - it depends. If you have the same concept validated in the same way in 2 different features, this works. You might also have the same concept with different forms in each feature, requiring different validation. These details can only be fleshed out by learning about the business. 2:30 - Vertical slicing can have layers. VS is a way or organizing code. 5:00 - If you have such coupling, make sure you have a middleman, so you don't end up coupling them. Try to communicate a little bit indirectly, if you expect these features to change frequently. If they will not change or change rarely (again, you need to learn the business to know this), you could probably get away with a little bit more, but I'd still advise to favour low coupling. 6:00 - Messaging is a way to decouple features, but not the only one. Messaging should be implemented in a MicroS architecture because you have to deal with different systems. 6:50 - Use cases can be just CRUD operations, but not always. The mistake I see on some project is people forcing a problem to fit a pattern, instead of understanding the problem, providing a testable solution and then analyzing if some parts could be replaced by patterns.
@leopoldodonnell1979
@leopoldodonnell1979 3 ай бұрын
Great Topic Derek! When people first learn about some pattern, or technique, there is a tendency to think there is only one perfect way to exercise it. Maybe it’s the 80/20 rule for these capabilities. Real life gets in the way and it does take having a more nuanced understanding to get you to your goal. Videos like this help to demonstrate architecture as an engineering science and an art form.
@Cerebradoa
@Cerebradoa 24 күн бұрын
The VSA is a data centric architecture. The intention is that the slices share only the data (or an abstraction of them). If you start adding shared components like your "shared validation" layer, you will end up very fast in spaghetti code. The idea of having layers used to be "what happens if the customer asks me to change a behavior in "many" features which proved to be unlikely. VSA focuses in the more likely situation where the customer asks to change a behavior in "one" feature. Now, if you need to change this in 2 or more features they should be 2 or more changes requests. The only exception is when you need to change the data schema because of one feature. That could affect many features, and that's when typed data structure (provided by EF) and feature tests come to help.
@allinvanguard
@allinvanguard 6 ай бұрын
I like to think of VSA as an approach that mainly gained traction because a lot of developers do not see the value in infinite dogmatic abstractions as it's usually done with Clean Architecture. It's nice to see that you clean up with some myths akin to "What do I need to do to be VSA-compliant?" - That's the nice thing, there is nowhere near as much to follow 1:1 as with onion arch in order to achieve the architecture goals. If one feature is as simple as implementing it with a straightforward one or two file minimal api, while another one requires a more clean-architecture like abstraction setup, then I'm free to do just that. But the key is that I don't have to put up with abstractions to comply with a guidance if it adds no value in the end. It's a pragmatic approach suited to deal with the dynamic nature of changing requirements, instead of trying to do everything perfect upfront. At the end clean architecture and vertical slice are not mutually exclusive, but I can pick what I feel is useful instead of having it shoved down my throat.
@CodeOpinion
@CodeOpinion 6 ай бұрын
Well said.
@_IGORzysko
@_IGORzysko 5 ай бұрын
Hi Derek, Thanks for the video! 1:38 in that example of shared layer I think the common question is: should I share it or maybe it is worth of doing a code duplication so we do not depend on another project dll or nuget package in particular projects/modules.
@omarkomiha9429
@omarkomiha9429 3 ай бұрын
Good morning Derek, I was curious about the two books in the background on top of the table. I believe one of them is "Domain-Driven Design" by Eric Evan. What is the other book?
@CodeOpinion
@CodeOpinion 3 ай бұрын
The Art of Community
@cfv1982
@cfv1982 7 күн бұрын
Excuse me, I would like to inquire about the usage of Test-Driven Development (TDD) in the context of slice architecture. Is it more challenging to implement unit tests when employing this architectural approach?
@evancombs5159
@evancombs5159 6 ай бұрын
In my opinion, I wouldn't even call vertical slicing an architecture. At least to me, architecture implies it is prescriptive in some way. Whereas vertical slices is more just the natural manifestation of following the principle of high cohesion and low coupling. It doesn't make other architectures obsolete as it is often desirable to follow those architectures within a vertical slice.
@CodeOpinion
@CodeOpinion 6 ай бұрын
I'd agree with that, sorta. I made sure to make reference to it explicitly in the video, is that VSA, Clean, Event Driven, etc, are all concepts you can pick and choose what you apply that ultimately make up your specific architecture. So when people ask "what architecture do yo use?" my answer would be Buffet Architecture. kzbin.info/www/bejne/bnOXZWihprh-rck
@robotrabbit5817
@robotrabbit5817 6 ай бұрын
Thanks 👍
@thedacian123
@thedacian123 6 ай бұрын
Ok, so within a boundedcontext/microservice ,features are independent components/classes within the application layer which is, of course client of domain model?
@CodeOpinion
@CodeOpinion 6 ай бұрын
I wouldn't say independent. I would say features are specific use-cases that provide some type of business capability. You can have a grouping of features that can be closely related. As well as you may have a feature that's dependent on another feature apart of some type of workflow. The point however is you're focusing on capabilities/features and organizing code code around that at for forefront.
@figloalds
@figloalds 2 ай бұрын
I agree with a lot of the stuff you say here, your "Code Opinion" is very sound
@CodeOpinion
@CodeOpinion 2 ай бұрын
It's just an opinion 😜
@nokibulislam9423
@nokibulislam9423 6 ай бұрын
Awesome. So I am using VSA and inside each slices I use layers. I am just playign with architecture. My question is about communication. how should the communication be? Lets say feature A needs to call some repository of feature B. Should I directly call that? Or pull that repo out of the slice and let both of the slices use it? give me some ideas please. I have been thinking about this for a while.
@CodeOpinion
@CodeOpinion 6 ай бұрын
The question is too abstract because it depends on what and how things are related. My questions to ask are, do you need a repository? If so, what is related from A to B that's likely causing you transactional issues is my guess.
@nokibulislam9423
@nokibulislam9423 6 ай бұрын
@@CodeOpinion Lets say there is no repository. But I want some data from feature A in feature B. How should this happen?
@kabal911
@kabal911 5 ай бұрын
Why can't you just feature B from feature A? If you're using some like MediatR, you can inject IMediator/ISender, and use it as normal?
@TrongNguyen-yc1lx
@TrongNguyen-yc1lx 4 ай бұрын
According to video Features do not impact other features and Requires messaging to the decouple features. Also You can call repository every Features.
@Cerebradoa
@Cerebradoa 24 күн бұрын
The original idea of VSA is to share the data (yes, it is a data centric architecture). The "Domain" layer shown in the video, is not a real domain, but a data abstraction layer. Usually this EF context and migrations. Now, by using EF you don't need another layer of abstraction like "Repositories", but if you want to use them, they should go into this layer as well, so you have it available in every feature.
@unexpectedkAs
@unexpectedkAs 6 ай бұрын
VSA to me means: if thing A works obly with thing B, put them both in the same folder. I havefone it in the frontend as well: in wpf with mvvm, just put all the files for a screen in s folder with the screen name.
@CodeOpinion
@CodeOpinion 6 ай бұрын
On the micro-level, yes. This expands out farther as well into an entire service boundary and putting capabilities that relate together.
@Cesar-qi2jb
@Cesar-qi2jb 6 ай бұрын
I always thought you were advocating for micro-services and DDD. Change of direction? I would personally never sliced my domain.
@CodeOpinion
@CodeOpinion 6 ай бұрын
I'm an advocate for defining service boundaries around capabilities and loosely coupling the best you can between the,. I don't think I've ever really advocated for Microservices. I'd argue I think I've come off pretty harsh on synchronous service to service network calls between service boundaries.
@Cesar-qi2jb
@Cesar-qi2jb 6 ай бұрын
@@CodeOpinion 100% agreed on avoiding synchronous calls in distributed systems. My point is more about slicing a bounded context. Why split the domain entities folder to the point of requiring a shared folder? I am ok with modular monoliths but this vertical slice "thing" goes too far.
@kelsey_roy
@kelsey_roy 6 ай бұрын
@@CodeOpinionDDD BoundedContext.
@austincodes
@austincodes 6 ай бұрын
I'm the guy who hates abstractions 👋
@CodeOpinion
@CodeOpinion 6 ай бұрын
I'd define it as "useless" abstractions for me.
@kabal911
@kabal911 5 ай бұрын
I'm also the guy who hates pointless abstractions that litter many C# code bases 👍
@TrongNguyen-yc1lx
@TrongNguyen-yc1lx 4 ай бұрын
Thanks! Share nothing Little to no the abstraction Low barrier to entry Features do not impact other features Requires messaging to the decouple features CRUD is not use-case driven
@jwbonnett
@jwbonnett 6 ай бұрын
First
@ikotin123
@ikotin123 6 ай бұрын
no me
@CodeOpinion
@CodeOpinion 6 ай бұрын
@@ikotin123 This video was posted to members of my channel before it was published to the public. Hence the comment being before it was published.
The Bulkhead Pattern: How To Make Your System Fault-tolerant
8:03
Free your API. Misconceptions are holding you back!
9:07
CodeOpinion
Рет қаралды 16 М.
1❤️
00:20
すしらーめん《りく》
Рет қаралды 32 МЛН
狼来了的故事你们听过吗?#天使 #小丑 #超人不会飞
00:42
超人不会飞
Рет қаралды 58 МЛН
Clean Architecture vs Vertical Slice Architecture
8:44
Gui Ferreira
Рет қаралды 10 М.
Domain Modeling Gone Wrong - Part 2
10:32
CodeOpinion
Рет қаралды 13 М.
Stop leaking and implying logic in your Frontend
9:31
CodeOpinion
Рет қаралды 9 М.
Gen AI Assessment App
3:01
Teiva Systems
Рет қаралды 32
Goodbye long procedural code! Fix it with workflows
9:05
CodeOpinion
Рет қаралды 22 М.
Vertical Slice Architecture, not Layers!
46:24
CodeOpinion
Рет қаралды 112 М.
The pendulum swings! Microservices to Monoliths
10:29
CodeOpinion
Рет қаралды 25 М.
Tired of Layers? Vertical Slice Architecture to the rescue!
12:26
Web-Queue-Worker Architecture Style for Scaling
8:47
CodeOpinion
Рет қаралды 10 М.
Domain Modeling Gone Wrong - Part 1
8:21
CodeOpinion
Рет қаралды 25 М.
#miniphone
0:18
Miniphone
Рет қаралды 11 МЛН
Как я сделал домашний кинотеатр
0:41
RICARDO
Рет қаралды 1,5 МЛН
😱НОУТБУК СОСЕДКИ😱
0:30
OMG DEN
Рет қаралды 2,5 МЛН
👎Главный МИНУС планшета Apple🍏
0:29
Demin's Lounge
Рет қаралды 493 М.
3D printed Nintendo Switch Game Carousel
0:14
Bambu Lab
Рет қаралды 4,7 МЛН
Обзор игрового компьютера Макса 2в1
23:34