|
1 | 1 | ---
|
2 |
| -title: Vertical-Slice-Architecture |
3 |
| -aka: Layer-By-Feature |
| 2 | +title: Vertical Slice Architecture |
| 3 | +aka: Layer By Feature |
4 | 4 | category: Architectural
|
5 | 5 | language: en
|
6 | 6 | tag:
|
|
9 | 9 |
|
10 | 10 | ## Intent
|
11 | 11 |
|
12 |
| -package the application based on features. Each feature will have its own set of layers ( |
13 |
| -Models, Services, Repository and Controllers ). |
| 12 | +Organize the application according to its features. |
| 13 | +Each feature will comprise its distinct set of layers (Models, Services, Repository, and Controllers). |
14 | 14 |
|
15 | 15 | ## Explanation
|
16 | 16 |
|
17 |
| -> With vertical slice architecture we can have high cohesion within package and low coupling |
18 |
| -> among the packages. In Conceptual term |
| 17 | +Real-World Examples (Consider E-commerce) |
19 | 18 |
|
20 |
| -> Consider that you are going to make a backend service for a online e-commerce application. |
21 |
| -> initially you make it with usual grouping of controllers, models etc. but as the application |
22 |
| -> grows more it's requires implementation of new features. Let's say that you thought of having |
23 |
| -> orders, customers and products associated layers. But now you need to include another set of |
24 |
| -> features with Cart system and wishlists. Now it's really hard to integrate those features it |
25 |
| -> requires lot's of dependency modifications and mocking. So if you make the package by feature |
26 |
| -> it will be really feasible for future additions. General example. |
| 19 | +> In the context of an e-commerce application, the concept of vertical slice architecture becomes clear. |
| 20 | +> Imagine you're building a backend service for an online store. |
| 21 | +> Initially, you may organize it with the typical grouping of controllers, models, and other components. |
| 22 | +> As the application grows, the need arises to implement new features. |
| 23 | +
|
| 24 | +> For instance, you might have distinct layers for orders, customers, and products. However, as the application |
| 25 | +> evolves, you realize the necessity of integrating additional features like a Cart system and wishlists. |
| 26 | +> At this point, integrating these new features into the existing structure becomes challenging. |
| 27 | +> It demands significant dependency modifications and mocking, which can be time-consuming and error-prone. |
| 28 | +
|
| 29 | +> This is where vertical slice architecture proves its value. |
| 30 | +> By structuring the application based on features, |
| 31 | +> you create self-contained modules that encapsulate all the necessary components |
| 32 | +> (Models, Services, Repository, and Controllers) for a particular feature. |
| 33 | +> When you need to add new features, you can do so in a more isolated and manageable manner. |
| 34 | +
|
| 35 | +In Plain Words |
| 36 | + |
| 37 | +> Vertical slice architecture is like organizing your toolbox. |
| 38 | +> Instead of having all your tools mixed together, you group them based on the type of task they perform. |
| 39 | +> This way, when you need a specific tool for a particular job, |
| 40 | +> you can quickly find it without rummaging through a jumble of items. |
| 41 | +
|
| 42 | +> Similarly, in software development, vertical slice architecture involves organizing the codebase based on features. |
| 43 | +> Each feature has its own self-contained set of components, making it easier to add, modify, or remove features without disrupting the entire application. |
27 | 44 |
|
28 | 45 | ## Class diagram
|
29 | 46 |
|
|
0 commit comments