[aosd-discuss] AOP in C++ (without external tools)
Daniel Lohmann
daniel.lohmann at informatik.uni-erlangen.de
Mon Feb 9 07:39:36 EST 2004
christopher diggins wrote:
>I have written an article and working demo on how to implement pointcuts and
>aspects in C++ without resorting to external tools. I would appreciate
>comments on the technical accuracy of the article as well as whether I am
>repeating prior work. The article is available online at
>http://www.heron-language.com/aspect-cpp.html.
>
>
Hi Christopher,
To me it looks that your article describes basically an approach to
simulate a kind of execution advice by derivation and overriding
methods. This is supported by some macros to reduce the otherwise
necessary typing to override all those methods. While this may be an
appropriate solution in some places, it has (as you wrote) its clear
limitations. Even if we forget for a moment about the expressive power
of declarative joinpoint-languages in "real" AOP languages (which seems
to be impossible to reach with pure C++), I'am still missing important
"basic" AOP concepts like call-advice, introductions, exposing context
in advice code and so on.
I completly agree with you that even paritial AOP functionality can
"make code more managable and reusable" and that it is a good idea to
develop idioms to achieve this in pure C++. I just would like to see a
clear classification of such approaches regarding to a typical AOP
language like AspectC++ or AspectJ. Which constructs, spoken in terms of
such AOP languages, are covered by the approach and which are not. This
would help to decide if, for a certain set of requirements, a pure C++
solution is suitable or not.
You asked for some other work towards "AOP with pure C++":
- The almost best overview about AOP with pure C++ was a series of
articles written by Krzystof Czarnecki, Lutz Dominik and Ulrich W.
Eisenecker in 2001. They were published in the German computer magazine
iX (http://www.heise.de/ix) and are available online:
Part 1: http://www.heise.de/ix/artikel/2001/08/143/
Part 2: http://www.heise.de/ix/artikel/2001/09/142/
Part 3: http://www.heise.de/ix/artikel/2001/10/152/
They are written in German, however. I don't know if you can read
German, but you may want to take a look at the example code anyway.
- Another pure-language approach (using C++) was suggested by Detlef
Vollman on the Second GI Workshop on Aspect-Oriented Software
Development, Bonn, Germany, 2002. This position paper is availabe at
http://i44w3.info.uni-karlsruhe.de/~pulvermu/workshops/aosd2002/submissions/vollmann.pdf
- Not to forget Alexandrescu's policy-based design ("Modern C++
Design"), which is also frequently proposed as an approach for AOP in
C++. (IMHO policy-based design and AOP are very different concepts in
some important points.) However, I am sure you already know this book.
Regards
Daniel
More information about the discuss
mailing list