within our application, always we are going to write #2 types of logic.
1. primary business logic
primary business logic is the code that has to be mandatorily written aspart of the application to fulfill the requirement of the system we are developing. without this logic, the core functionality of the application doesn't exist.
2. secondary logic
secondary logic is the helper logic that always works with primary business logic in enhancing the functionality of the system, but the secondary logic is optional to exist within the application. with/without the secondary logic the core system functionality can be fulfilled. such a piece of the code written in the application is called "secondary logic".
- The secondary logic is something that commonly exists across several classes within the application, so it is also called as "cross-cutting logic".
- In a typical application, the primary business logic and cross-cutting logic is written together (intermingled) in such a way those cannot be separated easily. since the secondary logic is optional, at any point of time within the application we might want to get rid off it, in such case we cannot easily separate primary business logic from secondary logic of our application.
- since the secondary logic has been written across several classes within the application, removing the secondary logic incurred a huge amount of
1. rework
2. efforts
3. testing
instead we can use AOP
AOP is meant for managing and applying the secondary logic / cross-cutting logic across various classes within our application.
AOP instructs us to keep primary business logic and secondary logic separately within individual components, but we wanted them to be executed together.
To have them executed together, we need to refer one inside the another, but this eventually results in writing them together which leads to huge maintenance when we want to get rid of it.
- Aspect => store something using the program.
- JointPoint => Where we add and something point.
- Advice => What we do in JoinPoint.
- PointCut => Multiple JoinPoint matchtes
- Target => The component on whom we want to apply the aspect logic is called "Target".
- Weaving => The process of combining the aspect logic with the target class jointpoint is called
- Proxy => It is a combination of aspect advice with the target class.
Comments
Post a Comment