[aosd-discuss] Scope of AOP..

eaddy@cs.columbia.edu eaddy at cs.columbia.edu
Fri Apr 7 13:13:11 EST 2006


>
> On 6 Apr 2006, at 22:11, Marc Eaddy wrote:
>
>>> I would expect that modern runtime environments indeed
>>> optimize such function calls away.
>>>
>>> In Java, I suspect that the logging method is roughly
>>> implemented like this:
>>>
>>> static boolean loggingEnabled = true;
>>>
>>> public void log(String msg) {
>>>    if (loggingEnabled) {
>>>      System.out.println(msg);
>>>    }
>>> }
>>>
>>
>> I assume the implemention above is not using AOP.  In that case,
>> you'll end
>> up with some concerns, e.g., logging, being implemented using OOP
>> and some
>> with AOP, e.g., tracing.  Since both concerns are crosscutting, I'd
>> like to
>> use the same uniform AOP implementation for both.  For example, I
>> may want
>> logging and tracing to both be disabled using the same flag, or I
>> may want
>> them to send messages to the same destination.  Statement Annotations
>> unifies homogeneous (tracing) and heterogeneous (logging) concerns
>> because
>> it allows both concerns to be implemented using the same unified AOP
>> solution.
>
> What makes logging and tracing so different that you think they have
> to be implemented using different mechanisms?
>

That's precisely my point.  They are only different insofar as
AspectJ-like languages requires us to treat them differently.  Any other
perspective on the system (e.g., requirements, design, base programmer)
probably treats them the same.  To implement tracing in AspectJ-like
languages you just use a call pointcut.  However, to implement logging the
approaches are a) modularize logging completely with fragile and
complicated aspects (100% AOP), b) use dummy methods and robust aspects
(part OOP and part AOP), and c) use a separate logging API (100% OOP).

Now we have added a fourth option d) use statement annotations and robust
aspects (100% AOP).

>>> With macros, you can achieve a similar effect. Here is a
>>> similar macro in Common Lisp...
>>
>> My argument is the same.  I'd like a unified solution for both
>> logging and
>> tracing, not one that uses macros and one that uses AOP.  I'm not a
>> Lisp/Scheme expert, so please correct me if it is possible to
>> implement/modularize all crosscutting concerns using macros.
>
> Probably not. If you are willing to enumerate the join points to be
> captured by a pointcut by inserting annotations to all the relevant
> places (join point shadows), then macros are probably sufficient. For
> quantified pointcuts ("all setters in class xyz and all its
> subclasses"), this probably won't work (except by using some low-
> level hacks, like redefining defmethod, etc.). It seems to me that
> your proposal doesn't support quantified pointcuts either, unless I
> am missing something.
>

Our proposal is just an extension of AspectJ so it does support
quanitified pointcuts, e.g.,

aspect LogAspect {
	before(Log logAnnotation) : @annotation(logAnnotation) {
		System.out.println(logAnnotation.value());
	}
}

>
> Pascal
>
> --
> Pascal Costanza, mailto:pc at p-cos.net, http://p-cos.net
> Vrije Universiteit Brussel, Programming Technology Lab
> Pleinlaan 2, B-1050 Brussel, Belgium
>
>
>
>




More information about the discuss mailing list