Kiczales and Mezini - FOAL 2005 1 AOP and Modular Reasoning [ICSE05] Start with first-principles...

6
Kiczales and Mezini - FOAL 2005 1 AOP and Modular Reasoning [ICSE05] Start with first-principles definition of modularity and modular reasoning localization, interfaces, enforcement, composition Provide example and analysis showing that: in the presence of ccc, OOP is not modular in the presence of ccc, AOP is modular But… interfaces depend on system configuration AOP makes that explicit explains more about what crosscutting means ______ [ICSE05] Kiczales and Mezini.

Transcript of Kiczales and Mezini - FOAL 2005 1 AOP and Modular Reasoning [ICSE05] Start with first-principles...

Page 1: Kiczales and Mezini - FOAL 2005 1 AOP and Modular Reasoning [ICSE05] Start with first-principles definition of modularity and modular reasoning –localization,

Kiczales and Mezini - FOAL 2005 1

AOP and Modular Reasoning [ICSE05]• Start with first-principles definition of modularity

and modular reasoning– localization, interfaces, enforcement, composition

• Provide example and analysis showing that:– in the presence of ccc, OOP is not modular– in the presence of ccc, AOP is modular

• But…– interfaces depend on system configuration– AOP makes that explicit– explains more about what crosscutting means

______[ICSE05] Kiczales and Mezini.

Page 2: Kiczales and Mezini - FOAL 2005 1 AOP and Modular Reasoning [ICSE05] Start with first-principles definition of modularity and modular reasoning –localization,

Kiczales and Mezini - FOAL 2005 2

• Aspect cuts interface– through Point and Line

• What crosscutting means

• The gestalt of AOP

aspect UpdateSignaling {

private Display Shape.display;

public void Shape.setDisplay(Display d) { this.display = d; }

pointcut change(Shape shape): this(shape) && (execution(void Shape.moveBy(int, int) || execution(void Shape+.set*(*)));

after(Shape s) returning: change(s) { Display.update(s); }}

Crosscutting Structure and Interfaces

class Line { private Point p1, p2;

Point getP1() { return p1; } Point getP2() { return p2; }

void setP1(Point p1) { this.p1 = p1; } void setP2(Point p2) { this.p2 = p2; }}

class Point {

private int x = 0, y = 0;

int getX() { return x; } int getY() { return y; }

void setX(int x) { this.x = x; } void setY(int y) { this.y = y; }}

Page 3: Kiczales and Mezini - FOAL 2005 1 AOP and Modular Reasoning [ICSE05] Start with first-principles definition of modularity and modular reasoning –localization,

Kiczales and Mezini - FOAL 2005 3

Parts

Page 4: Kiczales and Mezini - FOAL 2005 1 AOP and Modular Reasoning [ICSE05] Start with first-principles definition of modularity and modular reasoning –localization,

Kiczales and Mezini - FOAL 2005 4

Composed parts

• composition determines– both interfaces and component structure

m

Page 5: Kiczales and Mezini - FOAL 2005 1 AOP and Modular Reasoning [ICSE05] Start with first-principles definition of modularity and modular reasoning –localization,

Kiczales and Mezini - FOAL 2005 5

• Parts stay the same• Interfaces are extended• Declarative• What “details” means can change

aspect UpdateSignaling {

private Display Shape.display;

public void Shape.setDisplay(Display d) { this.display = d; }

pointcut change(Shape shape): this(shape) && (execution(void Shape.moveBy(int, int) || execution(void Shape+.set*(*)));

after(Shape s) returning: change(s) { Display.update(s); }}

Crosscutting Structure and Interfaces

class Line { private Point p1, p2;

Point getP1() { return p1; } Point getP2() { return p2; }

void setP1(Point p1) { this.p1 = p1; } void setP2(Point p2) { this.p2 = p2; }}

class Point {

private int x = 0, y = 0;

int getX() { return x; } int getY() { return y; }

void setX(int x) { this.x = x; } void setY(int y) { this.y = y; }}

Page 6: Kiczales and Mezini - FOAL 2005 1 AOP and Modular Reasoning [ICSE05] Start with first-principles definition of modularity and modular reasoning –localization,

Kiczales and Mezini - FOAL 2005 6

Why paper matters to us• What theory of AOP should say

– interface depends on configuration– “aspect control” systems can account for that– expand “modular” to encompass AOP

• that has been the idea for 10 years

• Stop focusing on advice and simple pointcuts!– inter-type declarations– more interesting pointcuts (i.e. dflow, pcflow…)– the fun is in saying

“there is a well-definable crosscutting interface there,I’m going to define it and program against it”

– a chance to play with all that fancy semantics (AOP as a strategic technology)