You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: layers/README.md
+21-12
Original file line number
Diff line number
Diff line change
@@ -10,26 +10,33 @@ tags:
10
10
---
11
11
12
12
## Intent
13
-
Layers is an architectural pattern where software responsibilities are
14
-
divided among the different layers of the application.
13
+
14
+
Layers is an architectural pattern where software responsibilities are divided among the different
15
+
layers of the application.
15
16
16
17
## Explanation
17
18
18
19
Real world example
19
20
20
-
> Consider a web site displaying decorated cakes for weddings and such. Instead of the web page directly reaching into the database, it relies on a service to deliver this information. The service then queries the data layer to assimilate the needed information.
21
+
> Consider a web site displaying decorated cakes for weddings and such. Instead of the web page
22
+
> directly reaching into the database, it relies on a service to deliver this information. The
23
+
> service then queries the data layer to assimilate the needed information.
21
24
22
-
In Plain Words
25
+
In plain words
23
26
24
-
> With Layers architectural pattern different concerns reside on separate layers. View layer is interested only in rendering, service layer assembles the requested data from various sources, and data layer gets the bits from the data storage.
27
+
> With Layers architectural pattern different concerns reside on separate layers. View layer is
28
+
> interested only in rendering, service layer assembles the requested data from various sources, and
29
+
> data layer gets the bits from the data storage.
25
30
26
31
Wikipedia says
27
32
28
-
> In software engineering, multitier architecture (often referred to as n-tier architecture) or multilayered architecture is a client–server architecture in which presentation, application processing, and data management functions are physically separated.
33
+
> In software engineering, multitier architecture (often referred to as n-tier architecture) or
34
+
> multilayered architecture is a client–server architecture in which presentation, application
35
+
> processing, and data management functions are physically separated.
29
36
30
37
**Programmatic Example**
31
38
32
-
On the data layer, we keep our cake building blocks. Cakes consist of layers and topping.
39
+
On the data layer, we keep our cake building blocks. `Cake` consist of layers and topping.
33
40
34
41
```java
35
42
@Entity
@@ -47,7 +54,7 @@ public class Cake {
47
54
}
48
55
```
49
56
50
-
The service layer offers CakeBakingService for easy access to different aspects of cakes.
57
+
The service layer offers `CakeBakingService` for easy access to different aspects of cakes.
51
58
52
59
```java
53
60
publicinterfaceCakeBakingService {
@@ -66,7 +73,7 @@ public interface CakeBakingService {
66
73
}
67
74
```
68
75
69
-
On the top we have our view responsible of rendering the cakes.
76
+
On the top we have our `View` responsible of rendering the cakes.
70
77
71
78
```java
72
79
publicinterfaceView {
@@ -92,14 +99,16 @@ public class CakeViewImpl implements View {
92
99
```
93
100
94
101
## Class diagram
102
+
95
103

96
104
97
105
## Applicability
106
+
98
107
Use the Layers architecture when
99
108
100
-
*you want clearly divide software responsibilities into different parts of the program
101
-
*you want to prevent a change from propagating throughout the application
102
-
*you want to make your application more maintainable and testable
109
+
*You want clearly divide software responsibilities into different parts of the program.
110
+
*You want to prevent a change from propagating throughout the application.
111
+
*You want to make your application more maintainable and testable.
0 commit comments