In cases of /simple /"do this too" code any real possibility of side-effects to the existing code, AOP makes sense.
Having done a lot of monitoring and logging code, I've found that in many cases it involves much more (e.g. examining various existing local variables or interweaving throughout existing method bodies) than what one can reasonably do via AOP. If you have cases that are simple enough and sufficiently side-effect-free that you don't see a need for those examining the code to see what you're doing, then great, use AOP. That said, the pain of AspectJ (in terms of its onerous impact on the build process or relatively high penalty for load-time weaving) has turned me off even in these cases -- except for cases of dynamic, ad-hoc addition of extra logging or monitoring in a production system. Even there one has to be excruciatingly careful with one's aop.xml or you'll grind everything to a halt. -- Jess Holle Mikael Sundberg wrote: > Howdy, i use AOP some at work and cant realy see a way to do it any > other good way. > > for example, management suddenly got the idea that everytime someone > saves anything in one application that should be monitored. So we can > see who did what. I looked some at annotations and such but that seemd > like hard work to annotate al the save methods. So i ended upp with 3 > or 4 lines of AOP code and everytime a save or update method is called > its also stored who did what. Nothing to remeber when i add new > functionality, it just works. > > Another time there was suddenly a requirement for logging all method > calls and return values, once again... 3-4lines of aop. > > how could any of that have been done without AOP? > > /Micke --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "The Java Posse" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/javaposse?hl=en -~----------~----~----~----~------~----~------~--~---
