[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Aspect Oriented Programming in context of lightweight languages.



Matthew Estes wrote:
>     I've been reading on Aspect Oriented Programming for a while, and I 
> was having a hard time getting my head around it. On the surface, it 
> seems useful to me, but it seems everyone loves the "adding logging to 
> an application example", and other problems solved by it aren't just 
> busting out of my head.

A good starting point for AOP is http://aosd.net. It contains links and 
a mailing list archive. There have been discussions about applications 
of AOP in that mailing list not so long ago.

>     In a Lightweight/Little Languages context, I was curious both for 
> examples of (specific) problems it solves, and whether it applies to 
> something besides a mostly procedural/OO language like Java. For 
> instance, how does AOP relate to Lisp? Does Lisp already do it? How?

You could rightfully say that AOP is a continuation of the work that had 
been done in the context of Common Lisp's metaobject protocol (MOP). 
After all, Gregor Kiczales, who coined the term aspect-oriented 
programming, also worked on the MOP.

The Common Lisp Object System (CLOS, embedded in Common Lisp) already 
provides so-called standard method combinations, which are basically 
before/after/around methods as you know them from AspectJ. However, you 
can provide (i.e. program) your own method combinations...

A good starting point for CLOS is the overview written by Richard 
Gabriel and Linda DeMichiel that you can find at 
http://www.dreamsongs.com/Essays.html

After that you can read the section on "Method Selection and 
Combination" in chapter 28 of "Common Lisp The Language, 2nd Edition" by 
Guy Steele. You can download the book at 
http://www-2.cs.cmu.edu/afs/cs.cmu.edu/project/ai-repository/ai/html/cltl/cltl2.html

If you want to dig deeper into the MOP, go to 
http://www.lisp.org/mop/index.html or get a copy of "The Art of the 
Metaobject Protocol" by Gregor Kiczales, Jim Des Rivieres and Daniel Bobrow.

There are surely other ways of getting an understanding of the matter, 
but I have found these texts to be especially helpful.


Personally, I think that a MOP + macros are much more powerful than any 
of the other aspect-oriented approaches I have seen so far. However, 
logic meta-programming seems very interesting to me. Other approaches 
include program transformations, role/view concepts and template 
meta-programming to a certain degree. (The problem with AOP at the 
moment is that it covers too many approaches IMHO.)


Pascal

-- 
Pascal Costanza               University of Bonn
mailto:costanza@web.de        Institute of Computer Science III
http://www.pascalcostanza.de  Römerstr. 164, D-53117 Bonn (Germany)