This is a new thread to keep the discussion clean
Your caching example in chapter 3 of "AspectJ in Action
Practical Aspect-Oriented Programming" shows how caching can be factored out in an aspect for a factoring application.
The core factoring method is only a few lines while the optimization by means of caching is done by an aspect.
In your note you state that the real value of this aspect is that all caching can be kept seperate from the core application.
That is right. At the same time this creates a side effect.
After a programmer has thouroughly tested an application the last thing he or whe wants is that something from outside can affect the outcome.
Well, that is exactly what can happen with an aspect.
The slightest error in the logic of an aspect can not only ruine my carefully crafted and tested module, but that of all other components involved !
The apect behaves like a virus, infecting all components with the same bug.
To make things even more complicated: several indepently working aspects can combined introduce interaction errors. Interaction errors can make the system unstable and the resulting bugs extremely difficult to track down because they happen every now and then when a particular set of conditions meet.
The end result can be an unmaintainable system in stead of an easy maintainable system using OO only.
My question is:
What in AOP is so good that it warrants side effects which can make the system unstable and maybe even unmaintainable ?