Go Deep into the Rabbit Hole and Enter a Wonderland of Possibilities with Aspect Oriented Programming
Aspect Oriented Programming (or AOP) is a programming paradigm that allows objects to be built containing just the business logic of an application, with cross-cutting concerns such as logging, caching or transaction management maintained independently. Sometimes referred to as the Interceptor Pattern, these cross-cutting aspects are applied to the application code automagically only at run time.
It sounds like a wonderful concept, but there are drawbacks and dangers as well. For those willing to accept those risks in their code, AOP can open up a whole new wonderland of possibilities, but for many it’s a form of magic.
There are developers that dislike any form of “magic” in their code, for whom even PHP’s built-in magic methods like __get and __set() are anathema, and for whom closure binding is a forbidden alchemy: the dark voodoo of AOP is certainly not something for them. But for those who are prepared to embrace its sorcery, AOP is the route to a wonderland of new possibilities.
So shall we enter the rabbit hole and see what lies within?