[aosd-discuss] Hyper/J vs Apect-J

Arno.Schmidmeier at sirius-eos.com Arno.Schmidmeier at sirius-eos.com
Mon Sep 23 07:35:54 EDT 2002


Delegation is fine, and I prefere delegation. 
I also didn't reimplement the logging behaviour. 
In the sample, the abstract aspect invokes an (abstract) method getLogger(),

and the concrete aspects, returns the actual logger instance, 
which is responsible for the logging operation.
Much simplier and easier to understand, than having a secondary 
logger selection factory somewhere lurking around, just to avoid aspect
inheritance. Currently all logger implementations, JDK 1.4 logging API,
log4J, etc. are plain OO, and they will be used.

I agree also to your second thesis:
"If you use delegators, the objects you delegate to are normal objects, so
you can
weave aspects on them."

But I CAN NOT use simple object delegator, at least not in aspectJ, or does
anybody 
know a delegate version of following advice:

String around():ReconnectableMethods(){
    String toReturn=null;
    try{
       toReturn=proceed();
    }catch(NotConnected e){
        reconnect(thisJoinPoint.getTarget());
        toReturn=proceed();
    }
    if (toReturn==null)
       return "";
}

Note: proceed CAN NOT be invoked by java reflection, just because the
pointcut may be adviced from different advices.

kind regards
    Arno

-----Original Message-----
From: Laurent Martelli
To: discuss at aosd.net
Sent: 9/23/02 1:30 PM
Subject: Re: [aosd-discuss] Hyper/J vs Apect-J

>>>>> "Arno" == Arno Schmidmeier <Arno.Schmidmeier at sirius-eos.com>
writes:

[...]

  Arno> Now if I list some basic requirements for a construct aspect:

[...]

  Arno> *Aspects should allow a classification, (e.g. having a generic
  Arno> logger aspect, and a concrete subtype which logs to a database
  Arno> and a different one, which logs to flat files, etc). A kind of
  Arno> Inheritance would be my option for this solution.

I would rather advocate delegation in this case. Aspects should only
be glue code between two (or more) sets of classes. Inheritance forces
you to have an aspect class per implementation of logging. If you
delegate, you can easily reuse legacy logging classes with one generic
aspect. 

[...]

  Arno> What I am missing more and more every day is a possibility to
  Arno> advice advices.

I'm not sure if this fullfills your demands, but if you use
delegators, the objects you delegate to are normal objects, so you can
weave aspects on them.

Regards,
Laurent

-- 
Laurent Martelli                        http://jac.aopsys.com/
laurent at bearteam.org
http://www.bearteam.org/~laurent/

_________________________________________________
AOSD discuss mailing list    -   discuss at aosd.net
To be removed send mail to discuss-admin at aosd.net
or visit http://aosd.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://server2.hostvalu.com/pipermail/discuss_aosd.net/attachments/20020923/de53d078/attachment.htm


More information about the discuss mailing list