separation of implementation concerns

Subject: separation of implementation concerns
From: Karl Lieberherr (
Date: Wed Jan 30 2002 - 09:04:42 EST

Hi John:

here is even a better way to implement your thesis project.
The goal is to have an easy to maintain addition to AspectJ.
We discussed the language integration issues and implementation techniques
yesterday in COM 3362.

Theo suggested that the best way to create the class graph is to get
it from the class files. Please talk to Johan: he is our expert
in residence how to read and modify class files. You
need only the reading part.

It is important to see that this is a very generic task
not specific to AspectJ and some people have probably already done it.
Maybe you can find some code for this on the web.

The second point is to put the traversals into a traversal aspect file
which has the following form:

traversal aspect A {
  t = from Company to Salary;
  t1 = from Division to Department;

Such a file will have an extension *.trav and when we invoke your

ajc-sung *.java *.trav

the following will happen:

1. Desugar the AspectJ aspects in *.java by translating
   traversal(t) to call(* t(..)) and
   crossing(e) to call(* e_t(..))
2. Read the *.trav files and for "t = from Company ..." produce
   a temporary implementation
   aspect Traversals {
     Company.t() {}
   in file
3. ajc *.java // using standard AspectJ
   This should compile and produce *.class files.
4. Produce the class graph by a separate program
   cg-extract *.class > cg
5. Use the cg and the AP library to generate the permanent implementation
   aspect Traversal {
     Company.t() { ... }
     Division_List.t() { ... }
6. ajc *.java // using standard AspectJ
   This will weave it all together.

Ease of maintenance:

1. If AspectJ changes we might have to update step 1. It is unlikely
   that AspectJ will change in this part.
2. If the class file format changes, we have to modify step 4.

None of those steps requires modification of AspectJ code which
shows proper separation of concerns for the implementation
approach and an approach we can maintain independent of how
the AspectJ team rearranges their code.

The advantage of the above separation is also conceptually useful.
All traversal specifications are in one place rather than scattered
through several aspects. This will incourage traversal reuse
and composition with join and merge.

-- Karl

This archive was generated by hypermail 2b28 : Wed Jan 30 2002 - 09:04:43 EST