Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Drawbacks of AOP

On Thursday 17 April 2003 19:24, Marc Tremblay wrote:
> I think further to this, a method has a certain contract to fulfill, and it
> should in no way rely on aspects to fulfill that contract.  Nor should
> aspects be allowed to change the contract.  

I definitifly disagree here. Transaction handling is a counterexample. 
Transaction handling is definitifly a crosscutting concern. In quite a lot of 
transaction aware programs, I have seen there is code like this (in plent 
places):

public void foo(){
    TransactionManager.startTransaction();
    try{
       //original code of foo
    }catch(RuntimeException ex){
      TransactionManager.abort();
      throw ex;
    }
    TransactionManager.commit();
}

All the transaction handling code should be moved to an aspect. 
And Transactionhandling does definitfly change some of the contract of the 
methods. 

> If one follows these rules,
> then it's quite irrelevant as to whether an aspect crosscuts a piece of
> code or not.  This way the code works the same everywhere...  the system as
> a whole may work differently (ie. logging behaviour is different, or we
> gain/lose resource pooling), but that has more to do with the context
> within which the code runs as opposed to the code itself.

But this limitation is much to strict. Most of the more advanced crosscutting 
concerns change the contracts of a method. e.g. security, persistency, 
accesscontrol, transaction handling, encription of parameters, etc. 

>
> To me aspects are similar to macros in C in that just because you can do
> all kinds of crazy things using them, it doesn't mean you should.
>

I agree. You with care, but use them!!!!!
kind regards
   Arno


> -- Marc
>
> > -----Original Message-----
> > From: aspectj-users-admin@xxxxxxxxxxx
> > [mailto:aspectj-users-admin@xxxxxxxxxxx]On Behalf Of John Rayburn
> > Sent: April 15, 2003 10:19 AM
> > To: aspectj-users@xxxxxxxxxxx
> > Subject: RE: [aspectj-users] Drawbacks of AOP
> >
> >
> > Just some random thoughts on the matter...
> >
> > Is this not one of the key elements of AOP - that the affected code need
> > not know that the aspect exists because it is an aspect of the system
> > that may affect one pointcut this compile and another the next.
> > Implementation of standard programming practices (avoid side-effects,
> > etc.) will help to ensure that aspects will not affect the system in a
> > harmful manner.  Use of tools will ensure that we can see how the
> > aspect-oriented system is composed.
> >
> > One key concern that may be had is that harmful aspects will be written.
> > Tools can help us identify where aspects are affected, and if a pointcut
> > applies to a portion of code that we didn't expect, re-write the
> > pointcut to be more exact.
> >
> > John Rayburn
> > Threewide Corporation
> > 304.594.8081 mailto:jrayburn@xxxxxxxxxxxxx
> >
> >
> > -----Original Message-----
> > From: Maximilian Stoerzer [mailto:stoerzer@xxxxxxxxxxxxxxxxxxxxxxxxx]
> > Sent: Tuesday, April 15, 2003 10:11 AM
> > To: aspectj-users@xxxxxxxxxxx
> > Subject: Re: [aspectj-users] Drawbacks of AOP
> >
> > Hi everybody!
> >
> > I think there is a difference in OO and AOP. In OO, you have a
> > structured way to find out which method is actually called by simply
> > making your way up the inheritance hierarchy.
> >
> > In AOP you can not do that, at least not as it is implemented in
> > AspectJ. Without tool support you might not even be aware of an aspect
> > influencing (or even replacing) a method you are calling.
> >
> > Any aspect can globally influence any method of the system. There is no
> > structured way to find out what functionality is actually executed by
> > reading the source of a class anymore.
> >
> > So I think the problem about "awareness" is quite important - that's why
> >
> > there is so much effort to create tools to reveal this influence.
> >
> > Best Regards,
> >     Max
> >
> > Robert Wenner wrote:
> > >I wonder how much this "aware of the aspect" problem counts in some
> > >years...
> > >
> > >After all, we already got used to overwriting methods.
> > >Or does anybody reject OO because it isn't  as obvious as in
> > >traditional C programming which method will in fact be called?
> > >
> > >Robert
> > >_______________________________________________
> > >aspectj-users mailing list
> > >aspectj-users@xxxxxxxxxxx
> > >http://dev.eclipse.org/mailman/listinfo/aspectj-users
> >
> > --
> > Maximilian Stoerzer
> > Lehrstuhl Software Systeme - FMI - University of Passau
> > Tel: +49 851 509 3096, eMail: stoerzer@xxxxxxxxxxxxxxxxx
> >
> >
> > _______________________________________________
> > 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
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> http://dev.eclipse.org/mailman/listinfo/aspectj-users

-- 

******************************************************************************
Arno Schmidmeier
+49/9151/90 50 30
or A@xxxxxxxxxxxxxxx
******************************************************************************
Yes, I have realized several projects with AspectJ.
Yes, I do provide consulting for AspectJ.



Back to the top