What is Aspect-Oriented Programming(AOP)? By using the diagram below, the concept can be understood in a few seconds.
The cross-cutting concerns problem
First take a took at the diagram below, and think about what could be the problem.
In the diagram above, it is easy to see that log related actions are everywhere. It causes two common problems:
1. Code tangling: the logging code is mixed with business logic.
2. Code scattering: caused by identical code put in every module.
The logging function is a called “cross-cutting concern”. That is, a function that is used in many other modules, such as authentication, logging, performance, error checking, data persistence, storage management, to name just a few.
By using Object-Oriented Programming (OOP), we can define low coupling and high cohesion system. However, when it comes to cross-cutting concerns, it does not handle it well for the reason that it does not relation between handle core concerns and cross-cutting concerns.
Solution from AOP
This post is very good. Quick and straight to the point.
Do you mind if I borrow this diagram idea (I’ll make my own version of it) for presentations that I give on AOP or in my upcoming AOP book?
I love these diagrams