Skip to content

Commit 24d5063

Browse files
committed
Added better explanation and updated README.md
1 parent cf06c64 commit 24d5063

File tree

2 files changed

+35
-18
lines changed
  • vertical-slice-architecture

2 files changed

+35
-18
lines changed

Diff for: vertical-slice-architecture/README.md

+30-13
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
2-
title: Vertical-Slice-Architecture
3-
aka: Layer-By-Feature
2+
title: Vertical Slice Architecture
3+
aka: Layer By Feature
44
category: Architectural
55
language: en
66
tag:
@@ -9,21 +9,38 @@ tag:
99

1010
## Intent
1111

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).
1414

1515
## Explanation
1616

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)
1918

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.
2744
2845
## Class diagram
2946

Diff for: vertical-slice-architecture/src/main/java/com/iluwatar/verticalslicearchitecture/App.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@
2828
import org.springframework.boot.autoconfigure.SpringBootApplication;
2929

3030
/**
31-
* Main application.
32-
* The main objective of this code sample is for you to have a look at how the view, entity, repository and Service are
33-
* organized.
34-
* No matter what application you are building Layer by Feature will always give the upper hand of better
35-
* maintainability.
31+
* This application is designed with a vertical slice architecture, organizing features such as
32+
* customer management, order processing, and product catalog in separate modules. Each feature encapsulates
33+
* its own set of components (Models, Services, Repository, and Controllers), promoting high cohesion
34+
* within each module and low coupling between them. This architecture allows for seamless integration of new
35+
* features and functionalities as the application evolves over time.
3636
*/
3737

3838
@SpringBootApplication

0 commit comments

Comments
 (0)