Integrating Adaptive and Aspect-Oriented Programming

Adaptive Programming (AP) is a kind of aspect-oriented programming (AOP). See:

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:

Paper: in Draft form; please comment

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


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 (* && target(a))
    via (call (* && 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 (* && target(a))
    via (call (* && 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 on B-objects and that are in turn within calls 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.