pointcut -based architectural interface for bridging a gap between design and implementation

26
POSL (Principles of Software Languages) Gr. Kyushu Institute of Technology, Japan http://posl.minnie.ai.kyutech.ac.jp/ Pointcut-based Architectural Interface for Bridging a Gap between Design and Implementation Naoyasu Ubayashi, Hidenori Akatoki, Jun Nomura July 7, 2009 ECOOP Workshop RAM-SE’09

Upload: effie

Post on 22-Jan-2016

38 views

Category:

Documents


0 download

DESCRIPTION

ECOOP Workshop RAM-SE’0 9. Pointcut -based Architectural Interface for Bridging a Gap between Design and Implementation. Naoyasu Ubayashi , Hidenori Akatoki , Jun Nomura July 7, 2009. Overview. Architecture. public class Subject{
 private Vector observers = new Vector(); - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Pointcut -based Architectural Interface for Bridging a Gap between Design and Implementation

POSL (Principles of Software Languages) Gr.Kyushu Institute of Technology, Japan

http://posl.minnie.ai.kyutech.ac.jp/

Pointcut-based Architectural Interfacefor

Bridging a Gap between Design and Implementation

Naoyasu Ubayashi, Hidenori Akatoki, Jun Nomura

July 7, 2009

ECOOP Workshop RAM-SE’09

Page 2: Pointcut -based Architectural Interface for Bridging a Gap between Design and Implementation

POSLposl.minnie.ai.kyutech.ac.jp

2

Overview Architectural design

plays an important role in the software development.– Robustness– Reliability– Maintainability

However, it is not easy to– implement the result of

architecture modeling as a program preserving the architectural correctness;

– maintain the traceability between an architecture and program code; and

– deal with software evolution.

public class Subject{    private Vector observers = new Vector(); private String state = “”;      public void addObserver(Observer o){ … }    public void removeObserver(Observer o){ … }    public void notify(){      Iterator i = observers.iterator();     while(i.hasNext() ){        Observers o = (Observer)i.next();        o.update( this );      }    } public void setState(String s){ state = s; } public String getState() {return state; }}

Progr

am C

ode

Bidirectional Traceability !

Archite

cture

Bug

Archface

Page 3: Pointcut -based Architectural Interface for Bridging a Gap between Design and Implementation

POSLposl.minnie.ai.kyutech.ac.jp

3

Outline Motivation Archface Archface for Java Discussion Conclusion

Page 4: Pointcut -based Architectural Interface for Bridging a Gap between Design and Implementation

POSLposl.minnie.ai.kyutech.ac.jp

4

1. MOTIVATION1. Motivation

Page 5: Pointcut -based Architectural Interface for Bridging a Gap between Design and Implementation

POSLposl.minnie.ai.kyutech.ac.jp

5

Motivating example

public class Subject { private String state = ""; public String getState() { return state; } public void setState(String s) { state = s; } … }

Architectural Design(Observer Pattern)

Code

Bug

Architectural constraints(Collaborative behavior)are not preserved !

Page 6: Pointcut -based Architectural Interface for Bridging a Gap between Design and Implementation

POSLposl.minnie.ai.kyutech.ac.jp

6

Solution ?

MDD + Code generation ? Fine, but …

Architectural design should be abstract !

Detaile

d

Mod

el

Descr

iption

s ProgramCode

Full codegeneration

Detailed modelgeneration

Page 7: Pointcut -based Architectural Interface for Bridging a Gap between Design and Implementation

POSLposl.minnie.ai.kyutech.ac.jp

7

Problems to be tackledIn current MDD, it is not easy to

create an architectural model with adequate abstraction level

implement the result of architecture modeling as a program preserving the architectural correctness

recover architecture from program code

maintain the traceability between architecture and program code

deal with software evolution.

Page 8: Pointcut -based Architectural Interface for Bridging a Gap between Design and Implementation

POSLposl.minnie.ai.kyutech.ac.jp

8

2. Archface

(= Architecture + Interface)

Page 9: Pointcut -based Architectural Interface for Bridging a Gap between Design and Implementation

POSLposl.minnie.ai.kyutech.ac.jp

9

public class Subject{    private Vector observers = new Vector(); private String state = “”;      public void addObserver(Observer o){ … }    public void removeObserver(Observer o){ … }    public void notify(){      Iterator i = observers.iterator();     while(i.hasNext() ){        Observers o = (Observer)i.next();        o.update( this );      }    } public void setState(String s){ state = s; } public String getState() {return state; }}

Our Approach

Archite

cture

Progr

am C

ode

Archface: architectural interface for bridging a gap between design modeling and implementationArchitectural information

is encapsulated in interfaces

Archface

Page 10: Pointcut -based Architectural Interface for Bridging a Gap between Design and Implementation

POSLposl.minnie.ai.kyutech.ac.jp

10

Architecture Descriptions Supported by Archface

Component-and-Connector Architecture (Structure)

Collaborations among Components (Behavior)

<Example: Observer Pattern>

Component Component

Collaboration

Signature-based Interface is insufficient.

Contextual Pointcut-based

InterfaceControl flow, Data flow, Trace match,

etc.

Page 11: Pointcut -based Architectural Interface for Bridging a Gap between Design and Implementation

POSLposl.minnie.ai.kyutech.ac.jp

11

Traditional Interface vs. Archface

Interface Expose methodsignatures

ArchfaceExpose program points

Method call

Coordinateexecution ofprogram points(Pointcut)

(Weave Advice)

ConnectionComponent

Page 12: Pointcut -based Architectural Interface for Bridging a Gap between Design and Implementation

POSLposl.minnie.ai.kyutech.ac.jp

12

Conceptual background

Join point

Architectural constraints can be specified by Pointcut & AdviceExtension of ccJava [Ubayashi, et al. 2007]

Three-part Modeling Framework[Masuhara, et al. 2003]

Page 13: Pointcut -based Architectural Interface for Bridging a Gap between Design and Implementation

POSLposl.minnie.ai.kyutech.ac.jp

13

Verifiable Bidirectional MDD

Not only programming-level but also design-level notion

ADL for bridging a gap between architectural design and implementation

Architectural Design

Archface

Program Code

Designs and verifies an architecture represented by Archface

Implements verified Archface

Page 14: Pointcut -based Architectural Interface for Bridging a Gap between Design and Implementation

POSLposl.minnie.ai.kyutech.ac.jp

14

1. MOTIVATION3. Archface for Java

Page 15: Pointcut -based Architectural Interface for Bridging a Gap between Design and Implementation

POSLposl.minnie.ai.kyutech.ac.jp

15

Archface as ADL

Observer Pattern represented by

Archface

ADL[Port notifyObservers]pointcut notifyObservers() : cflow(execution(void setState(String s))) && call(void notify());

[Port update]pointcut update():execution(void update());

[Connection]connects notifyChange (port1 :cSubject.notifyObservers, port2 :cObserver.update){ around() void :port1 { port2.proceed(); }}

Page 16: Pointcut -based Architectural Interface for Bridging a Gap between Design and Implementation

POSLposl.minnie.ai.kyutech.ac.jp

16

Archface as Program Interface

Archface(Program Interface)

Implement

Program Code(Implement exposed program points)

Type check+ formal verification+ test

Page 17: Pointcut -based Architectural Interface for Bridging a Gap between Design and Implementation

POSLposl.minnie.ai.kyutech.ac.jp

17

Bidirectional Traceability

Archface supports software evolution based on bidirectional traceability.

Archface can be considered as a protocol defined between architectural design and implementation.

Page 18: Pointcut -based Architectural Interface for Bridging a Gap between Design and Implementation

POSLposl.minnie.ai.kyutech.ac.jp

18

Integration with AO Archface supports not only OO but also

AO architecture. A weaving in AO can be realized by the

component-and-connector mechanism. We do not have to distinguish crosscutting

concerns from primary concerns at the architectural design phase.

Page 19: Pointcut -based Architectural Interface for Bridging a Gap between Design and Implementation

POSLposl.minnie.ai.kyutech.ac.jp

19

Example: Figure Editor

cDisplay cPoint

cLine

change

change

redraw

Page 20: Pointcut -based Architectural Interface for Bridging a Gap between Design and Implementation

POSLposl.minnie.ai.kyutech.ac.jp

20

Compiler construction

Archface definitions

Archface parser

AspectJ codegenerator

Aspect-Factoryclass generator

AspectJweaver

executable program

Archface compiler

AspectJ code (aspect)

Java code (class)

Page 21: Pointcut -based Architectural Interface for Bridging a Gap between Design and Implementation

POSLposl.minnie.ai.kyutech.ac.jp

21

1. MOTIVATION4. Discussion

Page 22: Pointcut -based Architectural Interface for Bridging a Gap between Design and Implementation

POSLposl.minnie.ai.kyutech.ac.jp

22

Related Work Architecture and Implementation:

– ArchJava [Aldrich, J. 2002]– Design pattern implementation in Java and AspectJ

[Hannemann, J. 2002] Co-evolution:

– Co-evolution between design and implementation [D'Hondt, T. 2001]

– Co-evolving the application design models after the code refactoring [Cazzola, W. 2007]

Aspect Component:– JAsCo [Suvee, D. et al. 2003]

Our approach is based on the interface mechanisms that not only enforce architectural constraints on the program implementation but also represent architectural abstractions.

Page 23: Pointcut -based Architectural Interface for Bridging a Gap between Design and Implementation

POSLposl.minnie.ai.kyutech.ac.jp

23

Open Issues

Which class of architecture is bi-directional ?– Currently, we consider control flow only…

Which class of architecture descriptions can be statically verified?

Which description should be tested?

Page 24: Pointcut -based Architectural Interface for Bridging a Gap between Design and Implementation

POSLposl.minnie.ai.kyutech.ac.jp

24

1. MOTIVATION5. Conclusion

Page 25: Pointcut -based Architectural Interface for Bridging a Gap between Design and Implementation

POSLposl.minnie.ai.kyutech.ac.jp

25

Summary

Archface is not only an ADL but also a programming-level interface mechanism.

The traceability between design and program code can be realized by enforcing architectural constraints specified in Archface on the program implementation.

Page 26: Pointcut -based Architectural Interface for Bridging a Gap between Design and Implementation

POSLposl.minnie.ai.kyutech.ac.jp

26

1. MOTIVATION

Thank you for your attention.