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
-SOLUTION: in order to solve the highly coupled problem we need to do:
73
-
1. Inversion of control: which is responsible for creating and managing objects
74
-
2. Dependency injection: to inject required dependencies for each object
73
+
- in order to, make software loosely coupled we need to apply:
74
+
1. Inversion of control principle: to create and manage objects
75
+
2. Dependency injection principle: to inject required dependencies for each object
75
76
76
77
### Spring container
77
78
@@ -100,22 +101,22 @@ class A {
100
101
101
102
<imgsrc="https://media.geeksforgeeks.org/wp-content/uploads/20200428011831/Bean-Life-Cycle-Process-flow3.png"title="bean life cycle src:geeksforgeeks.org"width="100%"height="500">
102
103
103
-
### Aspect-oriented programming
104
+
### Aspect-oriented programming (AOP)
104
105
105
-
- it's a programming paradigm that is used to increase software modularity by applying the separation of concerns principle
106
-
- let say we have 5 different classes each of which needs a logger method this architecture has a bad smell as 5 different classes have the same function therefore we decided to create a new class called logger and any class that want to log either extend or use logger class
107
-
- PROBLEM: 1-those classes will be highly dependent (coupling) on the cross-cutting class (logger class), 2- if we want to change some behavior of the logger class we need to pass through all the classes and modify them
108
-
- SOLUTION: here is where the AOP will come to solve those problems
109
-
1. Define point-cut (logger, security) point where it's used across multiple classes
110
-
2. call those cross-cutting objects an aspect (logger aspect, security aspect) a special separated class
111
-
3. create aspect configuration: these configurations will define what do you want to do and when
106
+
- it's a programming paradigm that uses the separation of concerns cross-cutting principle to increase modularity which consequently decreases coupling
107
+
-**Eg.** if we define 5 classes each one contains a logger object
108
+
- How to apply AOP ?
109
+
1. define point-cut (logger, security), points where cross-cutting concerns are applied
110
+
2. create aspect for each point-cut (logger aspect, security aspect) which defines what will this aspect do?
111
+
3. create aspect configurations, which defines when and where will those aspects execute?
112
112
113
113
### Model-view-controller
114
114
115
-
- it's a software design pattern "architecture" in which your software is separated into 3 parts:
116
-
1. Model: this component is responsible for dealing with data in the database
117
-
2. View: this component is responsible for dealing with user view (UI) in which the user will interact with
118
-
3. Controller: responsible for managing the flow between Model, view, and dealing with user requests and response
115
+
- it's a software architectural pattern in which your software is separated into 3 parts:
0 commit comments