Visualization of AOP
(Motivated by K. Czarnecki's AOP chapter)

The visualization maps source code lines to target code lines.
Below the source code lines are coming from two aspects A and B.
The target code lines give the reason for the aspect source
code lines they are influenced by.

location in 
transformed  code

reason |
       |
A,B    |  .                    .
       |
A,B    |  .                    .
       |
A,B    |                       .
       |
B      |                              .
A      |  .
       |
       |--.----------------*---.------.---------*
                  A                  B            location in
		  cd                 ap           source code

cd = UML class diagram
ap = adaptive program with traversal strategies and visitors

Above we show the mapping of three source code lines to target code lines.
The explanation below indicates that the mapping M from
source code lines to target code lines is in general not a function.
The example also shows that in general the same target code line
may be caused by multiple aspects. We say that the mapping 
is not injective.

The same cd line may be mapped into a class definition (determined
by cd) and several method definitions (determined by both cd and ap).

One transformed code line may be caused by both cd and ap. 
For example, line get_x.traverse() is caused by both cd and ap 
because the cd says the class has an x instance variable and the
ap says we need to traverse through x.

The same ap line may be mapped into several transformed code lines.
For example, the same visitor entry may be copied into several
classes or one traversal strategy affects several classes.

It may be useful to distinguish for a pair of aspects whether
the transformation is functional or injective.
(This is dependent on how the mapping is presented.)
For two aspects A and B, the simplest form of weaving is that
the lines in A are inserted once into the lines of B at certain join points.
In this case the mapping is functional and injective.

The example above from adaptive programming shows that 
interesting  mappings are neither functional nor injective.