Integrating Adaptive and Aspect-Oriented Programming

Adaptive Programming (AP) is a kind of aspect-oriented programming (AOP). See:
http://www.ccs.neu.edu/home/lieber/com3205/f02/lectures/ontology-2-karls-version.ppt

Aspect-oriented programming is a kind of adaptive programming: First, pointcut designators allow for structure-shy representations of sets of join points. Second, the virtual machine performs a traversal through the dynamic call graph.

Demeter helps AspectJ in the following ways:
(ease of programming) (1) parameterize introductions with traversal specifications (2) make type patterns structure-shy (3) visitors are shorter than advice (4) use traversal specifications in dynamic call graph instead of object graph.
(implementation) Use AP library to improve implementation of pointcuts with cflow.

See also:

http://www.ccs.neu.edu/research/demeter/DAJ/

http://daj.sourceforge.net/

Paper: in Draft form; please comment

@TECHREPORT{sl:2002:DAJ,
AUTHOR = "John Sung and Karl Lieberherr",
TITLE = "DAJ: A Case Study of Extending AspectJ",
INSTITUTION = "Northeastern University",
YEAR = 2002,
MONTH = "November",
NUMBER = "NU-CCS-02-16"
}
-- Karl Lieberherr

Notes:

So when we have a logging aspect in AspectJ:

aspect Logging {
  pointcut whatToLog(C c) : call (void foo()) && target(c);
  before whatToLog(C c) { ... };
}

which logs all calls to foo() on C-objects, we may want to
log only calls to a subset of C-objects:

aspect Logging {
  pointcut whatToLog(A a, B b, C c) : call (void foo()) && target(c) &&
  reachable(from (call (* A.bar()) && target(a))
    via (call (* B.bar()) && target(b))
  to (call (void foo() && target(c))));
  before whatToLog(A a, B b, C c) { ... };
}

Here reachable is a new pointcut designator:
  reachable(from (call (* A.bar()) && target(a))
    via (call (* B.bar()) && target(b))
  to (call (void foo() && target(c))));
describes the
subset of join points call (void foo()) on C-objects that are
with calls of B.bar() on B-objects and that are in turn within calls
A.bar() on A-objects.

reachable() can be viewed as a special case of the if pointcut.
It expresses a traversal constraint in terms of the dynamic call graph.