Our goal in Aspect Oriented Programming is to reduce the amount of boilerplate code.
Let's give an example, we have a service, and in this service, let's first print the service.start() log, then the service transaction log, and finally the standard log.
Our 1.log process and 3.log process are the same under the package, so we can reduce boirplate code writing by using it as Cross Cutting.
What is Aspect Oriented Programming?
AOP is an approach that helps reduce the complexity of the software and increase modularity. The purpose of modularization here is to separate the non-functional code, that is, the intersecting interests, used in many parts of the system during the application, into small pieces (Separation of Cross Cutting Concerns).In this way, the structures that will be used throughout the application are abstracted from the system and encapsulated. It allows it to be used in many places. In general, it can be said that AOP helps to make the existing system better rather than solving a problem.
At this point, we can perform common operations and reduction operations here.
What are the benefits of AOP?
- Our application is more flexible and easy to manage,
- Getting rid of repetitive code patterns,
- A cleaner and more understandable code,
- Separation from core logic and intersections.