Good code and web frameworks National Holiday: Voting Day
Mar 09

Definite synergies with AOP & EJB/J2EE

AOP, Tech Add comments

Ramesh Loganathan asked AOP & EJB/J2EE- any synergies?.

I personally think there are some obvious synergies, but the main point that I want to respond to comes from this paragraph:

Regardless, the fact simply remains that AOP cannot be a panacea for Systems Design issues. It is at some level, (even if I risk a sweeping conclusion here) not too different from say using a logging framework. Albeit, it can do a little (;-)) more than just logging. It can only “extend” an existing complete biz application to perform some additional plumbing. But cannot be used to build complete end-applications!

  • AOP is not a silver bullet
  • AOP does not mean you don’t do OOP anymore
  • AOP makes sense as a solution for CROSS CUTTING CONCERNS

I have to keep saying this, as I don’t want people to go down the same route as we did with OOP (and others) and think that everything should be an object. That is not the case. We need to use common sense, and move slowly.

Ron Bodkins, Ramnivas Laddad, myself, and others are working on an open source project that shows AOP in practice. We have some really nifty ways to handle:

  • Persistence: The user doesn’t have to worry about Hibernate sessions, you just use your POJOs
  • Security: The policy is external. One place to set it all up
  • Virtual Mock Objects: AOP can really help out here
  • … and many more …

We of course have a solution for logging, but I don’t want to mention that as people get SO distracted by AOP logging examples.

In our project there is PLENTY of OOP going on, with a sprinkling of AOP to help out where needed. We don’t go the extreme and do the following:

class Person { }

… aspects use mixins and other advice to plug everything in …

Don’t use aspects unless it makes sense. Do use them when it DOES make sense. With polymorthism in OOP we now favor composition. We can do the same in AOP… to keep us on track.

I am excited to be heading to the AOSD 2004 in the UK (Lancaster? weird). I think this will be a good year for AOP… so lets see where it leads us :)

2 Responses to “Definite synergies with AOP & EJB/J2EE”

  1. Ramesh Says:

    Addiing to Dion’s comments- Would like to clarify that the Synergies I was referring was between EJBs & AOP (and not OOP & AOP). OOP & AOP obviously have some common ground possible. Here agin, the point is that AOP still only EXTENDs OOP- and cannot replace OOPS!

    But when it comes to EJB/J2EE, unless some standardization happens and AOP is part of the common platform offering (J2EE), utility remians low. Further, with much of the functionality normally touted as use-=cases for AOP like Security, Transactions, Persistence already managed by the J2EE platform, the utility is further diminished.

    (More at- http://www.jroller.com/page/rameshl)

  2. dove deodorant Says:

    big thank

Leave a Reply

Spam is a pain, I am sorry to have to do this to you, but can you answer the question below?

Q: What is the number before 3? (just put in the digit)