[aosd-discuss] can you have interception w/o aop?
Roger Johansson
roger.johansson at compona.com
Wed Apr 5 08:51:41 EST 2006
>>Depends on whether with whatever technique you choose you achive to
>>implement the crosscut in a modular way, I would say.
when is a crosscut considered to be modular?
would a method that spits out bytecode for dynamic proxy logging considered
to be modular?
public void EmitLogging(someThing)
{
someThing.Emit(...);
someThing.Emit(...);
}
>Well, this would involve _copying_ all the methods on the superclass(es)
>and tweaking them in such a way that they do logging, right? (Or I got
>your proposal wrong.) Well, copying code can certainly not be seen as a
>way of implementing crosscutting features in a modular way because in
>your subclass the code would still be excessivly scattered. You would
>not have gained anything.
well, no that was not what i mean.
I mean a factory that takes a type and inherits it in runtime , overriding
every virtual method and in those injects a call to base/super and also some
code to perform logging.
so in designtime your code does not contain any scattered code , but in
runtime it does.
(just like any dynamic proxy aop approach.)
//Roger
----- Original Message -----
From: "Eric Bodden" <eric.bodden at mail.mcgill.ca>
To: "Roger Johansson" <roger.johansson at compona.com>
Cc: <discuss at aosd.net>
Sent: Wednesday, April 05, 2006 3:08 PM
Subject: RE: [aosd-discuss] can you have interception w/o aop?
Hi Roger.
Depends on whether with whatever technique you choose you achive to
implement the crosscut in a modular way, I would say.
> if we make a static factory that subclasses and inject
> logging code into every method or specific named methods , is
> it still aop or just interception?
Well, this would involve _copying_ all the methods on the superclass(es)
and tweaking them in such a way that they do logging, right? (Or I got
your proposal wrong.) Well, copying code can certainly not be seen as a
way of implementing crosscutting features in a modular way because in
your subclass the code would still be excessivly scattered. You would
not have gained anything.
> if you inject logging code and say "hey i can inject this in
> whatever i want and i think that my logger is an aspect"
> would that be considered aop?
See again above - does not depend on the way how you inject it but what
you achive, really.
> and when is a pointcut a pointcut?
> if i express it as dsl , or if i express it as static c# "if
> (method.Name.StartsWith("set_")" , is that a pointcut?
I would say that the following definition is reasonably precise: "A
pointcut is a predicate over the statis structure or dynamic behavior of
a program." Again, this does not depend on the way how you define this
predicate at all.
At the DOAL workshop at AOSD this year we had a discussion about
"library based approaches" to AOP vs. approaches facilitating "language
extensions". Gergor raised the (IMHO valid) point that any library can
in fact also be seen as a special constraint way of a language
extension, because in fatc it also comes with its own syntax (even
though within certain constraints of a base language) and semantics. So
from this point of view, the notion of an aspect/pointcut/advice is
really language independent.
Eric
--
Eric Bodden
Sable Research Group, McGill University
Montreal, Canada
More information about the discuss
mailing list