• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

Usage of AOP

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All AOP Expert,

This is more of a design question on AOP Usage. The classic usage of AOP has always been in security/logging/transaction etc. I am thinking of using AOP in more business context. I have a method that I need to call across multiple modules in some specific method. Is AOP appropriate here? The business method is not a pure Cross Cutting concern that affects all methods in the application but it does impact significant places. My thinking is that by using AOP can a centralize my code in a single place and prevent tight coupling as maybe I will change the signature of the method and then I will need to change all code that is calling that method. A friend of mine said that AOP should not be used as AOP should only be used non domain or business context.


What do you guys think?

Thanks

Tabiul
 
Ranch Hand
Posts: 1936
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Use AOP with caution. AOP gives illusion of simplicity, but actually it's more difficult to understand. Using Annotations is a way to make AOP easier to understand but still not clearest.

If you want to centralize your code, I think you can do without using AOP.
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I agree and disagree. It always depends on the use case. Is this something that you might want to remove later, or turn on and off at your whim. Then AOP is a great choice for it. Do you mind all the clutter/tangling code of the process in all your other code, that is needed but doesn't represent the Use Case of the method that you tangle this code in? Then AOP is a great choice for it.

But AOP is not the choice for everything. You really need to weight the pros and the cons, and know that sometimes debugging or determining where an error is coming from that might or might not be from AOP can be a little more difficult. Not with a great IDE that you can set break points, but sometimes you have to have two break points. One in the code before the AOP gets called, and one after in the real code. Because Proxies are being used.

Mark
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic