Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [aspectj-dev] Named advice

What do you think of having metadata tags on advice? It seems logical, and I assume it is possible to put metadata tags on anonymous classes so it's analogous to something in Java. It would also give a means of picking out advice elements.

Another possible use of named advice would be defining advice precedence within an aspect, rather than using ordering in the file. It would also facilitate tools support (so you can pick the advice to see in a browser and can see the name of the advice that affects something).

I don't feel that having an optional name for advice will add much complexity. I can't suggest making it mandatory because of backward compatibility. I do grant you that we have to set a high bar to adding features to preserve simplicity. 

For that matter, if we were willing to make incompatible changes, I'd rename "after" advice to "after finally", so it's more clear instead of confusing novices...

Ron

Ron Bodkin
Chief Technology Officer
New Aspects of Security
m: (415) 509-2895

> ------------Original Message-------------
> From: "Gregor Kiczales" <gregor@xxxxxxxxx>
> To: <aspectj-dev@xxxxxxxxxxx>
> Date: Mon, Aug-18-2003 11:19 AM
> Subject: RE: [aspectj-dev] Named advice
> 
> The main reason we didn't do named advice is:
> 
> >                              having them not named 
> > emphasizes advice isn't called like a method, but 
> > automatically executes when a pointcut matches.
> 
> Another way of seeing that is that advice names were not needed given
> the semantics of AspectJ. There were possible semantics that would use
> advice names, like the truly frightening possibility of suggesting that
> advice can override/ extend other advice with the same name.
> 
> Using the advice name in adviceexecution is the first non-frightening
> suggestion I remember seeing for how to use advice names in the
> semantics.  Again, since adviceexecution came up so late, it was much
> too late to think about adding advice names at that point.
> 
> 
> > Perhaps named advice could be added as an option, and we'll 
> > see whether the community embraces it or not. I suspect it 
> > will become the norm.
> 
> Ugh. That seems like a process for getting something as clean as C++.  :)
> 
> Lets re-explore the issue of whether it's the right thing, given
> adviceexecution, and given jsr175. Then let's see whether its worth
> the cost in terms of retrofitting it.
> 
> In general I think the pressure on AspectJ right now is to be simpler
> and smaller, rather than larger and more complex. So I *predict* that
> advice names won't clear the bar. But I've certainly been wrong before!
> 
> 
> 
> > -----Original Message-----
> > From: aspectj-dev-admin@xxxxxxxxxxx 
> > [mailto:aspectj-dev-admin@xxxxxxxxxxx] On Behalf Of Ron Bodkin
> > Sent: Monday, August 18, 2003 10:27 AM
> > To: aspectj-dev@xxxxxxxxxxx
> > Subject: Re: [aspectj-dev] Named advice
> > 
> > 
> > Backwards compatibility for binary aspect libraries is 
> > certainly a desirable quality. It appears that named advice 
> > would be a good way to achieve this, though there would 
> > surely be some subtleties (e.g., detecting changes in the 
> > context/pointcuts of advice).
> > 
> > I think named advice would be valuable for at least four 
> > other reasons:
> > 
> > 1) It encourages describing behavior. When designing a system 
> > with aspects, I describe the advice (important behavior) 
> > early on, and it's natural to name the advice. In code, it's 
> > also nice to have a descriptive name as well as a comment.
> > 2) It would allow picking out specific advices in 
> > adviceexecution PCD's. Perhaps we should also allow use of 
> > JSR-175 metadata tags on advice too (but that's another discussion...)
> > 3) It would facilitate debugging and reading stack traces: 
> > you can see what advice is running by name instead of seeing 
> > ajc$before$coverage_Coverage$29c.
> > 4) It will help newcomers to keep the concepts of pointcut 
> > and advice separate. Today, many see the idiom before() : 
> > namedPointcut() so much, they think of namedPointcut as the 
> > name of the advice...
> > 
> > 
> > Perhaps named advice could be added as an option, and we'll 
> > see whether the community embraces it or not. I suspect it 
> > will become the norm.
> > 
> > Ron Bodkin
> > Chief Technology Officer
> > New Aspects of Security
> > m: (415) 509-2895
> > 
> > > ------------Original Message-------------
> > > From: "Matthew Webster" <matthew_webster@xxxxxxxxxx>
> > > To: aspectj-dev@xxxxxxxxxxx
> > > Date: Mon, Aug-18-2003 8:19 AM
> > > Subject: [aspectj-dev] Named advice
> > > 
> > > I have discovered another reason for named advice: 
> > backwards compatibility
> > > for binary aspect libraries.
> > > 
> > > Currently the advice name e.g. 
> > "ajc$before$coverage_Coverage$29c" is based
> > > on the position in the source file where the advice is declared.
> > > Unfortunately if a trivial change is made to the aspect 
> > e.g. a comment is
> > > added the name changes. This makes binary aspect libraries that use
> > > abstract aspects as an "interface" extremely fragile: any 
> > clients must be
> > > rewoven. Although current guidelines suggest keep advice as thin as
> > > possible small changes to the aspect may be necessary. It 
> > would also be
> > > nice to able to add pointcuts and advice, perhaps to the 
> > end of an aspect,
> > > and maintain backwards compatibility similar to that offered by Java
> > > classes. Was numbering of advice sequentially in the 
> > source, starting
> > > perhaps with $1 like anonymous inner classes, not considered?
> > > 
> > > I suppose what we really need is the equivalent of the 
> > serialVersionUID for
> > > object serialization with a name generated based on the 
> > definition of the
> > > pointcuts on which it depends.
> > > 
> > > Matthew Webster
> > > AOSD Project
> > > Java Technology Centre, MP146
> > > IBM Hursley Park, Winchester,  SO21 2JN, England
> > > Telephone: +44 196 2816139 (external) 246139 (internal)
> > > Email: Matthew Webster/UK/IBM @ IBMGB, matthew_webster@xxxxxxxxxx
> > > http://w3.hursley.ibm.com/~websterm/
> > > 
> > > The IBM Academy is sponsoring a conference on 
> > Aspect-Oriented Software
> > > Development, 3rd-4th September, Yorktown, NY.
> > > 
> > > _______________________________________________
> > > aspectj-dev mailing list
> > > aspectj-dev@xxxxxxxxxxx
> > > http://dev.eclipse.org/mailman/listinfo/aspectj-dev
> > > 
> > _______________________________________________
> > aspectj-dev mailing list
> > aspectj-dev@xxxxxxxxxxx
> > http://dev.eclipse.org/mailman/listinfo/aspectj-dev
> > 
> 
> 
> _______________________________________________
> aspectj-dev mailing list
> aspectj-dev@xxxxxxxxxxx
> http://dev.eclipse.org/mailman/listinfo/aspectj-dev
> 


Back to the top