Skip to content

Commit db760bc

Browse files
authored
Update README.md
1 parent fde8d56 commit db760bc

File tree

1 file changed

+31
-21
lines changed

1 file changed

+31
-21
lines changed

README.md

Lines changed: 31 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,21 @@
1111
- [Spring Bean](#spring-bean)
1212
- [Bean Scope](#bean-scope)
1313
- [Bean life cycle](#bean-life-cycle)
14-
- [Aspect-oriented programming](#aspect-oriented-programming)
14+
- [Aspect-oriented programming](#aspect-oriented-programming-aop)
1515
- [Model-view-controller](#model-view-controller)
1616
- [Data Access Objects (DAO)](#data-access-objects-dao)
17-
- [Object-relational mapping (ORM)](#object-relational-mapping-orm)
17+
- [Code Samples Structure](#code-samples-structure)
1818
- [References](#-references)
1919

2020
<img src="https://spring.io/images/OG-Spring.png" title="spring logo, src:spring.io" width="100%" height="500">
2121

22+
---
23+
2224
## 🎯 Objective
2325

2426
1. Learn the theory behind spring
2527
2. grasp general concepts of spring
2628

27-
---
2829

2930
### What's spring & why to use it?
3031

@@ -69,9 +70,9 @@ class A {
6970
}
7071
```
7172

72-
- 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
7576

7677
### Spring container
7778

@@ -100,22 +101,22 @@ class A {
100101

101102
<img src="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">
102103

103-
### Aspect-oriented programming
104+
### Aspect-oriented programming (AOP)
104105

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?
112112

113113
### Model-view-controller
114114

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:
116+
<img src="https://qph.fs.quoracdn.net/main-qimg-c3f2bef1693561dfb24e0f00aa592c80" title="MVC, src:quora.com" width="400" height="300" style="float:rigth;">
117+
1. Model: it's a component that handles anything related to data in the software
118+
2. View: it's a component that deals with UI related stuff
119+
3. Controller: it's a component that manages flow between the other two components and handles any business logic in the software
119120

120121
### Data Access Objects (DAO)
121122

@@ -137,12 +138,21 @@ interface EmployeeDAO {
137138
}
138139
```
139140

140-
### Object-relational mapping (ORM)
141-
142-
- it's an abstract layer for accessing databases easily which maps data into simple objects (POJO or JSON)
143141

144142
---
145143

144+
### Code samples structure
145+
<img src="/diagrams/class-diagram.png" title="Class diagram" width="100%" height="400">
146+
147+
*Class Diagram*
148+
149+
<img src="/diagrams/spring-components.png" title="Spring components" width="100%" height="400">
150+
151+
*Spring Components*
152+
153+
> **_Note:_** This is not the optimal structure and you may find some little changes in some examples for simplification purposes
154+
155+
146156
## 🔗 References
147157

148158
1. [Spring & Hibernate for Beginners (includes spring boot)](https://www.udemy.com/course/spring-hibernate-tutorial/)

0 commit comments

Comments
 (0)