Advice Execution As Partial Order Over The Control Flow Article Index for
Advice
Shopping
Advice
Website Links For
Advice
 

Information About

Advice Execution As Partial Order Over The Control Flow




First we assume that all pieces of advice are around advice. This is WLOG because any piece of advice can be translated in such a way.

For any given joinpoint ''p'', we have a set ''advice(p)'' of pieces of advice that match ''p''. (This set may of course be empty.) This leads to the partial order
  • orall a \in advice(p): a > p.


Usually for such pieces of advice it is undetermined which one is executed first. Some languages as AspectJ always give the first piece of advice that appears in a given compilation unit the highest priority. But if the pieces of advice are spread over various aspects, this leads to confusion and indeterminism. Thus actually all AOP frameworks enable programmers to specify precedences of certain aspects over others. In combination with the "first stated, first executed" rule, this leads to the following total order:
  • orall a \in advice(p): a > p

  • orall a_1,a_2 \in advice(p): a_1 > a_2 Iff

  • ---aspect(a_1) has higher precedence than aspect(a_2) or

  • ---aspect(a_1) == aspect(a_2) and a_1 stated before a_2.


Note that this is really only a total order if for all pairs of aspects precedences are declared - which is hardly ever the case, especially when aspects come from different parties.

Also note that even without AOP it is not always obvious exactly which method is being called by a given method call. In Object-oriented Programming , the method of the lowest subclass that overrides the given signature is actually called. Thus, the recipient of a call can always be uniquely determined (in contrast to AOP). However, the recipient can change at runtime, depending on what runtime type a declared object actually possesses.