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

Post on 22-Jan-2016

38 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

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

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

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

POSLposl.minnie.ai.kyutech.ac.jp

3

Outline Motivation Archface Archface for Java Discussion Conclusion

POSLposl.minnie.ai.kyutech.ac.jp

4

1. MOTIVATION1. Motivation

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 !

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

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.

POSLposl.minnie.ai.kyutech.ac.jp

8

2. Archface

(= Architecture + Interface)

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

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.

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

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]

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

POSLposl.minnie.ai.kyutech.ac.jp

14

1. MOTIVATION3. Archface for Java

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(); }}

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

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.

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.

POSLposl.minnie.ai.kyutech.ac.jp

19

Example: Figure Editor

cDisplay cPoint

cLine

change

change

redraw

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)

POSLposl.minnie.ai.kyutech.ac.jp

21

1. MOTIVATION4. Discussion

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.

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?

POSLposl.minnie.ai.kyutech.ac.jp

24

1. MOTIVATION5. Conclusion

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.

POSLposl.minnie.ai.kyutech.ac.jp

26

1. MOTIVATION

Thank you for your attention.

top related