Rejuvenate Pointcut: A Tool for Pointcut Expression Recovery in Evolving Aspect-Oriented Software

28
Brief Introduction to AOP Rejuvenation Approach Simple Motivating Example Downloads Rejuvenate Pointcut 1 A Tool for Pointcut Expression Recovery in Evolving Aspect-Oriented Software Raffi Khatchadourian, Awais Rashid [email protected],[email protected] Ohio State University, Lancaster University September 29, 2008 1 This material is based upon work supported in part by European Commission grants IST-33710 (AMPLE) and IST-2-004349 (AOSD-Europe). Raffi Khatchadourian, Awais Rashid Rejuvenate Pointcut

description

Aspect-Oriented Programming (AOP) strives to localize the scattered and tangled implementations of crosscutting concerns (CCCs) by allowing developers to declare that certain actions (advice) should be taken at specific points (join points) during the execution of software where a CCC (an aspect) is applicable. However, it is non-trivial to construct optimal pointcut expressions (a collection of join points) that capture the true intentions of the programmer and, upon evolution, maintain these intentions. We demonstrate an AspectJ source-level inferencing tool called Rejuvenate Pointcut, which helps developers maintain pointcut expressions over the lifetime of a software product. A key insight into the tool’s construction is that the problem of maintaining pointcut expressions bears strong similarity to the requirements traceability problem in software engineering; hence, the underlying algorithm was devised by adapting existing approaches for requirements traceability to pointcut maintenance. The Eclipse IDE-based tool identifies intention graph patterns pertaining to a pointcut and, based on these patterns, uncovers other potential join points that may fall within the scope of the pointcut with a given confidence. This work represents a significant step towards providing tool-supported maintainability for evolving aspect-oriented software.

Transcript of Rejuvenate Pointcut: A Tool for Pointcut Expression Recovery in Evolving Aspect-Oriented Software

Page 1: Rejuvenate Pointcut: A Tool for Pointcut Expression Recovery in Evolving Aspect-Oriented Software

Brief Introduction to AOPRejuvenation Approach

Simple Motivating ExampleDownloads

Rejuvenate Pointcut1

A Tool for Pointcut Expression Recovery in EvolvingAspect-Oriented Software

Raffi Khatchadourian, Awais [email protected],[email protected]

Ohio State University, Lancaster University

September 29, 2008

1This material is based upon work supported in part by EuropeanCommission grants IST-33710 (AMPLE) and IST-2-004349 (AOSD-Europe).

Raffi Khatchadourian, Awais Rashid Rejuvenate Pointcut

Page 2: Rejuvenate Pointcut: A Tool for Pointcut Expression Recovery in Evolving Aspect-Oriented Software

Brief Introduction to AOPRejuvenation Approach

Simple Motivating ExampleDownloads

Outline

1 Brief Introduction to AOP

2 Rejuvenation Approach

3 Simple Motivating ExamplePhase I: AnalysisPhase II: Rejuvenation

4 Downloads

Raffi Khatchadourian, Awais Rashid Rejuvenate Pointcut

Page 3: Rejuvenate Pointcut: A Tool for Pointcut Expression Recovery in Evolving Aspect-Oriented Software

Brief Introduction to AOPRejuvenation Approach

Simple Motivating ExampleDownloads

Aspect-Oriented Programming

AOP reduces scattering and tangling of crosscutting concern(CCCs) implementations.

Developer specifies behavior (advice).

Advice is composed at specific execution points (join points).

Join points specified via pointcut expressions (PCEs).

Raffi Khatchadourian, Awais Rashid Rejuvenate Pointcut

Page 4: Rejuvenate Pointcut: A Tool for Pointcut Expression Recovery in Evolving Aspect-Oriented Software

Brief Introduction to AOPRejuvenation Approach

Simple Motivating ExampleDownloads

Aspect-Oriented Programming

AOP reduces scattering and tangling of crosscutting concern(CCCs) implementations.

Developer specifies behavior (advice).

Advice is composed at specific execution points (join points).

Join points specified via pointcut expressions (PCEs).

Raffi Khatchadourian, Awais Rashid Rejuvenate Pointcut

Page 5: Rejuvenate Pointcut: A Tool for Pointcut Expression Recovery in Evolving Aspect-Oriented Software

Brief Introduction to AOPRejuvenation Approach

Simple Motivating ExampleDownloads

Aspect-Oriented Programming

AOP reduces scattering and tangling of crosscutting concern(CCCs) implementations.

Developer specifies behavior (advice).

Advice is composed at specific execution points (join points).

Join points specified via pointcut expressions (PCEs).

Raffi Khatchadourian, Awais Rashid Rejuvenate Pointcut

Page 6: Rejuvenate Pointcut: A Tool for Pointcut Expression Recovery in Evolving Aspect-Oriented Software

Brief Introduction to AOPRejuvenation Approach

Simple Motivating ExampleDownloads

Aspect-Oriented Programming

AOP reduces scattering and tangling of crosscutting concern(CCCs) implementations.

Developer specifies behavior (advice).

Advice is composed at specific execution points (join points).

Join points specified via pointcut expressions (PCEs).

Raffi Khatchadourian, Awais Rashid Rejuvenate Pointcut

Page 7: Rejuvenate Pointcut: A Tool for Pointcut Expression Recovery in Evolving Aspect-Oriented Software

Brief Introduction to AOPRejuvenation Approach

Simple Motivating ExampleDownloads

Example PCEs

execution(* Foo.*(..))

execution(* Foo.methodA())

Raffi Khatchadourian, Awais Rashid Rejuvenate Pointcut

Page 8: Rejuvenate Pointcut: A Tool for Pointcut Expression Recovery in Evolving Aspect-Oriented Software

Brief Introduction to AOPRejuvenation Approach

Simple Motivating ExampleDownloads

Example PCEs

execution(* Foo.*(..))

execution(* Foo.methodA())

Raffi Khatchadourian, Awais Rashid Rejuvenate Pointcut

Page 9: Rejuvenate Pointcut: A Tool for Pointcut Expression Recovery in Evolving Aspect-Oriented Software

Brief Introduction to AOPRejuvenation Approach

Simple Motivating ExampleDownloads

Fragile Pointcut Problem

Constructing optimal pointcut expressions that capture trueintentions of where a CCC applies can be difficult.

Ideally, pointcut expressions (PCEs) should remain valid asthe software evolves.

However, situations arise where base-code alterations inducethe invalidity of existing PCEs.

PCEs must be amended as a result.

But which join points should be included?

Can we automatically infer join points that should be includedin the new version of the PCE upon evolution?

Raffi Khatchadourian, Awais Rashid Rejuvenate Pointcut

Page 10: Rejuvenate Pointcut: A Tool for Pointcut Expression Recovery in Evolving Aspect-Oriented Software

Brief Introduction to AOPRejuvenation Approach

Simple Motivating ExampleDownloads

Fragile Pointcut Problem

Constructing optimal pointcut expressions that capture trueintentions of where a CCC applies can be difficult.

Ideally, pointcut expressions (PCEs) should remain valid asthe software evolves.

However, situations arise where base-code alterations inducethe invalidity of existing PCEs.

PCEs must be amended as a result.

But which join points should be included?

Can we automatically infer join points that should be includedin the new version of the PCE upon evolution?

Raffi Khatchadourian, Awais Rashid Rejuvenate Pointcut

Page 11: Rejuvenate Pointcut: A Tool for Pointcut Expression Recovery in Evolving Aspect-Oriented Software

Brief Introduction to AOPRejuvenation Approach

Simple Motivating ExampleDownloads

Fragile Pointcut Problem

Constructing optimal pointcut expressions that capture trueintentions of where a CCC applies can be difficult.

Ideally, pointcut expressions (PCEs) should remain valid asthe software evolves.

However, situations arise where base-code alterations inducethe invalidity of existing PCEs.

PCEs must be amended as a result.

But which join points should be included?

Can we automatically infer join points that should be includedin the new version of the PCE upon evolution?

Raffi Khatchadourian, Awais Rashid Rejuvenate Pointcut

Page 12: Rejuvenate Pointcut: A Tool for Pointcut Expression Recovery in Evolving Aspect-Oriented Software

Brief Introduction to AOPRejuvenation Approach

Simple Motivating ExampleDownloads

Fragile Pointcut Problem

Constructing optimal pointcut expressions that capture trueintentions of where a CCC applies can be difficult.

Ideally, pointcut expressions (PCEs) should remain valid asthe software evolves.

However, situations arise where base-code alterations inducethe invalidity of existing PCEs.

PCEs must be amended as a result.

But which join points should be included?

Can we automatically infer join points that should be includedin the new version of the PCE upon evolution?

Raffi Khatchadourian, Awais Rashid Rejuvenate Pointcut

Page 13: Rejuvenate Pointcut: A Tool for Pointcut Expression Recovery in Evolving Aspect-Oriented Software

Brief Introduction to AOPRejuvenation Approach

Simple Motivating ExampleDownloads

Fragile Pointcut Problem

Constructing optimal pointcut expressions that capture trueintentions of where a CCC applies can be difficult.

Ideally, pointcut expressions (PCEs) should remain valid asthe software evolves.

However, situations arise where base-code alterations inducethe invalidity of existing PCEs.

PCEs must be amended as a result.

But which join points should be included?

Can we automatically infer join points that should be includedin the new version of the PCE upon evolution?

Raffi Khatchadourian, Awais Rashid Rejuvenate Pointcut

Page 14: Rejuvenate Pointcut: A Tool for Pointcut Expression Recovery in Evolving Aspect-Oriented Software

Brief Introduction to AOPRejuvenation Approach

Simple Motivating ExampleDownloads

Fragile Pointcut Problem

Constructing optimal pointcut expressions that capture trueintentions of where a CCC applies can be difficult.

Ideally, pointcut expressions (PCEs) should remain valid asthe software evolves.

However, situations arise where base-code alterations inducethe invalidity of existing PCEs.

PCEs must be amended as a result.

But which join points should be included?

Can we automatically infer join points that should be includedin the new version of the PCE upon evolution?

Raffi Khatchadourian, Awais Rashid Rejuvenate Pointcut

Page 15: Rejuvenate Pointcut: A Tool for Pointcut Expression Recovery in Evolving Aspect-Oriented Software

Brief Introduction to AOPRejuvenation Approach

Simple Motivating ExampleDownloads

The Idea

Capture rich program element relationships in a concern graphadapted for AOP.

Associate graph elements with join point shadows containedin the PCE.

Extract patterns from finite, acyclic paths in the graph.

Place wildcards in place of the associated elements.

Apply the patterns to the evolved version of the base-code.

Raffi Khatchadourian, Awais Rashid Rejuvenate Pointcut

Page 16: Rejuvenate Pointcut: A Tool for Pointcut Expression Recovery in Evolving Aspect-Oriented Software

Brief Introduction to AOPRejuvenation Approach

Simple Motivating ExampleDownloads

The Idea

Capture rich program element relationships in a concern graphadapted for AOP.

Associate graph elements with join point shadows containedin the PCE.

Extract patterns from finite, acyclic paths in the graph.

Place wildcards in place of the associated elements.

Apply the patterns to the evolved version of the base-code.

Raffi Khatchadourian, Awais Rashid Rejuvenate Pointcut

Page 17: Rejuvenate Pointcut: A Tool for Pointcut Expression Recovery in Evolving Aspect-Oriented Software

Brief Introduction to AOPRejuvenation Approach

Simple Motivating ExampleDownloads

The Idea

Capture rich program element relationships in a concern graphadapted for AOP.

Associate graph elements with join point shadows containedin the PCE.

Extract patterns from finite, acyclic paths in the graph.

Place wildcards in place of the associated elements.

Apply the patterns to the evolved version of the base-code.

Raffi Khatchadourian, Awais Rashid Rejuvenate Pointcut

Page 18: Rejuvenate Pointcut: A Tool for Pointcut Expression Recovery in Evolving Aspect-Oriented Software

Brief Introduction to AOPRejuvenation Approach

Simple Motivating ExampleDownloads

The Idea

Capture rich program element relationships in a concern graphadapted for AOP.

Associate graph elements with join point shadows containedin the PCE.

Extract patterns from finite, acyclic paths in the graph.

Place wildcards in place of the associated elements.

Apply the patterns to the evolved version of the base-code.

Raffi Khatchadourian, Awais Rashid Rejuvenate Pointcut

Page 19: Rejuvenate Pointcut: A Tool for Pointcut Expression Recovery in Evolving Aspect-Oriented Software

Brief Introduction to AOPRejuvenation Approach

Simple Motivating ExampleDownloads

The Idea

Capture rich program element relationships in a concern graphadapted for AOP.

Associate graph elements with join point shadows containedin the PCE.

Extract patterns from finite, acyclic paths in the graph.

Place wildcards in place of the associated elements.

Apply the patterns to the evolved version of the base-code.

Raffi Khatchadourian, Awais Rashid Rejuvenate Pointcut

Page 20: Rejuvenate Pointcut: A Tool for Pointcut Expression Recovery in Evolving Aspect-Oriented Software

Brief Introduction to AOPRejuvenation Approach

Simple Motivating ExampleDownloads

Phase I: AnalysisPhase II: Rejuvenation

Base-code

package p;

public class A {

int f;

void m1() {

int a = f + 1;

}

void m2() {

int b = f + 2;

}

void n() {

int c = f + 3;

}

}

Raffi Khatchadourian, Awais Rashid Rejuvenate Pointcut

Page 21: Rejuvenate Pointcut: A Tool for Pointcut Expression Recovery in Evolving Aspect-Oriented Software

Brief Introduction to AOPRejuvenation Approach

Simple Motivating ExampleDownloads

Phase I: AnalysisPhase II: Rejuvenation

Concern Graph

A.m2()

A.f

gets_field

A.n()

gets_field

A

declares_method

declares_field

declares_method

A.m1()

declares_method

gets_field

p

contains

Raffi Khatchadourian, Awais Rashid Rejuvenate Pointcut

Page 22: Rejuvenate Pointcut: A Tool for Pointcut Expression Recovery in Evolving Aspect-Oriented Software

Brief Introduction to AOPRejuvenation Approach

Simple Motivating ExampleDownloads

Phase I: AnalysisPhase II: Rejuvenation

An Aspect

package p;

public aspect B {

before () : execution (* m*(..)) {

}

}

Raffi Khatchadourian, Awais Rashid Rejuvenate Pointcut

Page 23: Rejuvenate Pointcut: A Tool for Pointcut Expression Recovery in Evolving Aspect-Oriented Software

Brief Introduction to AOPRejuvenation Approach

Simple Motivating ExampleDownloads

Phase I: AnalysisPhase II: Rejuvenation

Concern Graph

A.m2()

A.f

gets_field

A.n()

gets_field

A

declares_method

declares_field

declares_method

A.m1()

declares_method

gets_field

p

contains

Raffi Khatchadourian, Awais Rashid Rejuvenate Pointcut

Page 24: Rejuvenate Pointcut: A Tool for Pointcut Expression Recovery in Evolving Aspect-Oriented Software

Brief Introduction to AOPRejuvenation Approach

Simple Motivating ExampleDownloads

Phase I: AnalysisPhase II: Rejuvenation

Base-code

// . . .void o() {

int d = f + 4;

}

// . . .

Raffi Khatchadourian, Awais Rashid Rejuvenate Pointcut

Page 25: Rejuvenate Pointcut: A Tool for Pointcut Expression Recovery in Evolving Aspect-Oriented Software

Brief Introduction to AOPRejuvenation Approach

Simple Motivating ExampleDownloads

Phase I: AnalysisPhase II: Rejuvenation

Concern Graph

A.m2()

A.f

gets_field

A.n()

gets_field

A.o()

gets_field

A

declares_method

declares_field

declares_method declares_method

A.m1()

declares_method

gets_field

p

contains

Raffi Khatchadourian, Awais Rashid Rejuvenate Pointcut

Page 26: Rejuvenate Pointcut: A Tool for Pointcut Expression Recovery in Evolving Aspect-Oriented Software

Brief Introduction to AOPRejuvenation Approach

Simple Motivating ExampleDownloads

Phase I: AnalysisPhase II: Rejuvenation

Patterns and Suggestions

Raffi Khatchadourian, Awais Rashid Rejuvenate Pointcut

Page 27: Rejuvenate Pointcut: A Tool for Pointcut Expression Recovery in Evolving Aspect-Oriented Software

Brief Introduction to AOPRejuvenation Approach

Simple Motivating ExampleDownloads

Tool and Material Downloads

Tool research prototype publicly available athttp://code.google.com/p/rejuvenate-pc.

Research related material publicly available athttp://sites.google.com/site/pointcutrejuvenation.

Raffi Khatchadourian, Awais Rashid Rejuvenate Pointcut

Page 28: Rejuvenate Pointcut: A Tool for Pointcut Expression Recovery in Evolving Aspect-Oriented Software

Brief Introduction to AOPRejuvenation Approach

Simple Motivating ExampleDownloads

Question for SCAM

Do more expressive PCE languages truly solve the fragile pointcutproblem?

Raffi Khatchadourian, Awais Rashid Rejuvenate Pointcut