[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [aspectj-users] Default EJB Implementation: OOP vs. AOP
|
To me there are two ways in which the AspectJ solution is better: multiple-
inheritance and where to apply the specific function. Having a "mix-in"
capability, so you can add default EJB handling to any EJB is useful. But the
use of declare parents to define where to provide default handling is an
improvement on mix-ins to me.
Consider an alternative scenario. Suppose you started off with a single base
class for all your EJBs, in which you added default implementations. Then you
realize that certain beans actually need to override their passivate methods.
You now need to refactor your hierarchy to look like this:
MyAbstractEJB
/ \
MyAbstractDefaultEJB MyAbstractMustPassivateEJB (even the NAMES smell!)
And then you have to go throughout your code base and edit which beans extend
MyAbstractDefaultEJB and which extend MyAbstractMustPassivateEJB.
By using mix-ins you avoid the need to create the artificial hierarchy. By
using declare parents, you avoid tangling the definition of where you must
passivate throughout your classes: you can have a policy (e.g., based on
package structure or other interfaces that were already implemented).(*)
Ron
(*) These two benefits are actually orthogonal. You _could_ use declare
parents to change base classes, and you _could_ have each class explicitly
extend the default ejb marker interface. But I find they work best together
in many scenarios.
On Thu, 29 Apr 2004 11:34:24 -0700, Nicholas Lesiecki wrote
> There isn't really an advantage other than the multiple inheritance
> IMHO. But that can be quite useful if you need your EJB to inherit
> from a non-EJB base class. The standard implementations of EJB
> methods are all pretty basic and I would make the case that they are
> better represented as a mix in style aspectj interface than as an
> abstract base class.
>
> Cheers,
> Nick
>
> On Apr 29, 2004, at 2:33 AM, Steffen Euch wrote:
>
> > Hi!
> >
> > I don't understand the advantage of a default EJB implementation with
> > AOP over a solution with pure OOP.
> >
> > In "Enterprise Aspect-Oriented Programming with AspectJ"
> > (http://newaspects.com/presentations/) it is suggested to implement
> > empty EJB callback methods using AspectJ. An interface is used that
> > implements the methods. With declare parents all SessionBeans are
> > advised to implement this interface.
> >
> > What is the advantage of this implementation? I can do the same thing
> > with a simple OOP super class as well. My Beans just extend this super
> > calss.
> >
> > (Ok, with the AOP-interface-solution multiple inheritance is possible.
> > But that is no convincing argument to me. I don't need multiple
> > inheritance in my EJBs.)
> >
> > Best regards,
> >
> > Steffen
> > _______________________________________________
> > aspectj-users mailing list
> > aspectj-users@xxxxxxxxxxx
> > http://dev.eclipse.org/mailman/listinfo/aspectj-users
> >
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> http://dev.eclipse.org/mailman/listinfo/aspectj-users
Ron Bodkin
Chief Technology Officer
New Aspects
m: (415) 509-2895