1 An Aspect-oriented Weaving Mechanism Based on Component-and-Connector Architecture Naoyasu Ubayashi (Kyushu Institute of Technology) February 12, 2008.

Slides:



Advertisements
Similar presentations
Mohamed ElBendary and John Boyland University of Wisconsin-Milwaukee.
Advertisements

A Context Analysis Method for Embedded Systems --- Exploring a Requirement Boundary between a System and Its Context Naoyasu Ubayashi(Kyushu University,
Aspect Oriented Programming. AOP Contents 1 Overview 2 Terminology 3 The Problem 4 The Solution 4 Join point models 5 Implementation 6 Terminology Review.
An Aspect-Oriented Approach For Web Application Access Control Presented by: Mohamed Hassan Carleton University Carleton University
©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 32 Slide 1 Aspect-oriented Software Development.
1 An Aspect-Aware Outline Viewer Michihiro Horie and Shigeru Chiba Tokyo Institute of Technology, Japan.
University of British Columbia Software Practices Lab Fluid AOP Join Point Models Terry Hon Gregor Kiczales.
Java.sun.com/javaone/sf | 2004 JavaOne SM Conference | Session BUS JavaOne 2004 What is AOP? Gregor Kiczales AspectMentor.com and University of.
Aspect-Oriented Programming Gregor Kiczales University of British Columbia © Copyright 2004, Gregor Kiczales. All rights reserved.
359C 10/1/05 Eric Wohlstadter Introductions –Name –Degree objective/Year –Research Area (or interests) Syllabus Aspect-Oriented Programming –AspectJ –AspectC.
ASPECT ORIENTED SOFTWARE DEVELOPMENT Prepared By: Ebru Doğan.
University of British Columbia Software Practices Lab CAS Seminar 06 Fluid AJ - A Simple Fluid AOP Tool Terry Hon Gregor Kiczales.
Aspect-oriented programming Laura Ricci A.A
Software modularity group Gregor Kiczales Professor and NSERC/Xerox/Sierra Systems Software Design Chair University of British Columbia Principal Scientist.
More on AspectJ. aspect MoveTracking { private static boolean _flag = false; public static boolean testAndClear() { boolean result = _flag; _flag = false;
Session 15 Modeling Traceability of Concerns in Architectural Views Mark Stobbe October 29,
Aspect-Oriented Programming with AspectJ™ AspectJ.org Xerox PARC Erik Hilsdale Gregor Kiczales with Bill Griswold, Jim Hugunin, Wes Isberg, Mik Kersten.
Aspect-Oriented Software Development (AOSD) Tutorial #3 AspectJ - continued.
A Formal Model of Modularity in Aspect-Oriented Programming Jonathan Aldrich : Objects and Aspects Carnegie Mellon University.
Deriving AO Software Architectures using the AO-ADL Tool Suite Luis Fernández, Lidia Fuentes, Mónica Pinto, Juan A. Valenzuela Universidad de Málaga
An Introduction to AOP Original slides developed by Julie Waterhouse and Mik Kersten for OOPSLA 2004 AspectJ Tutorial ( kerstens.org/mik/publications/aspectj-
Outline Introduction Problem Statement Object-Oriented Design Aspect-Oriented Design Conclusion Demo.
1 Archface: Architectural Interface -- Bridging a Gap between Design Modeling and Implementation Naoyasu Ubayashi, Hidenori Akatoki, Jun Nomura Kyushu.
Introduction to Aspect Oriented Programming Presented By: Kotaiah Choudary. Ravipati M.Tech IInd Year. School of Info. Tech.
Aspect Oriented Programming Razieh Asadi University of Science & Technology Mazandran Babol Aspect Component Based Software Engineering (ACBSE)
1 Metamodel Access Protocols for Extensible Aspect-Oriented Modeling Naoyasu Ubayashi(Kyushu Institute of Technology, Japan) Shinji Sano(Kyushu Institute.
©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 32 Slide 1 Aspect-oriented Software Development 1.
1 Model Compiler Construction Based on Aspect-oriented Mechanisms Naoyasu Ubayashi (Kyushu Institute of Technology) Tetsuo Tamai (University of Tokyo)
Aspect Oriented Programming Sumathie Sundaresan CS590 :: Summer 2007 June 30, 2007.
1 A Parameterized Interpreter for Modeling Different AOP Mechanisms Naoyasu Ubayashi(Kyushu Institute of Technology, Japan) Genki Moriyama(Kyushu Institute.
POSL (Principles of Software Languages) Gr. Kyushu Institute of Technology, Japan An Extensible Aspect-Oriented Modeling.
POSL (Principles of Software Languages) Gr. Kyushu Institute of Technology, Japan Pointcut-based Architectural Interface.
Aspect Oriented Programming Gülşah KARADUMAN.
Kiczales and Mezini - FOAL AOP and Modular Reasoning [ICSE05] Start with first-principles definition of modularity and modular reasoning –localization,
1 Model Evolution with Aspect-oriented Mechanisms Naoyasu Ubayashi (Kyushu Institute of Technology) Tetsuo Tamai (University of Tokyo) Shinji Sano, Yusaku.
Methodology: The AOP Refactoring Process Aspect-Oriented Refactoring of the Apache Cocoon Shared-Object Resource Allocation System Jeff Dalton Advisor:
A Distributed Aspect-Oriented System for J2EE Applications Muga Nishizawa and Shigeru Chiba (Tokyo Institute of Technology, Japan) Background - As benefits.
Design Rules for Increasing Modularity with CaesarJ Carlos Eduardo Pontual Advisor: Paulo Borba 17/06/2010.
AOSD1 Aspect-Oriented Software Design Karl Lieberherr Theo Skotiniotis.
AOP-1 Aspect Oriented Programming. AOP-2 Aspects of AOP and Related Tools Limitation of OO Separation of Concerns Aspect Oriented programming AspectJ.
Devon M. Simmonds Computer Science Department, CSC592 1 Devon M. Simmonds Computer Science Department University of North Carolina, Wilmington
1 An Aspect-Oriented Implementation Method Sérgio Soares CIn – UFPE Orientador: Paulo Borba.
Aspect-Oriented Programming and Modular Reasoning G. KiczalesM. Mezini Presented by Alex Berendeyev.
Architectural Point Mapping for Design Traceability Naoyasu Ubayashi and Yasutaka Kamei Kyushu University, Japan March 26, 2012 FOAL 2012 (AOSD Workshop)
IDENTIFYING SEMANTIC DIFFERENCES IN ASPECTJ PROGRAMS Martin Görg and Jianjun Zhao Computer Science Department, Shanghai Jiao Tong University.
Weaving a Debugging Aspect into Domain-Specific Language Grammars SAC ’05 PSC Track Santa Fe, New Mexico USA March 17, 2005 Hui Wu, Jeff Gray, Marjan Mernik,
1 Contract-based Verification for Aspect-oriented Refactoring Naoyasu Ubayashi(Kyushu Institute of Technology) Jinji Piao(Kyushu Institute of Technology)
Demeter Aspects We study techniques for the emerging area of Aspect-Oriented Software Development and focus on the following areas:  Aspectual Collaborations.
Applying Translucid Contracts for Modular Reasoning about Aspect and Object Oriented Events Mehdi Bagherzadeh Gary T. Leavens Robert Dyer Foundations of.
Alloy-based Lightweight Verification for Aspect-oriented Architecture Naoyasu Ubayashi(Kyushu Institute of Technology) Yuki Sato(Kyushu Institute of Technology)
AOP and observer pattern. Design pattern General reusable solution to a commonly occurring problem in software design Not a finished design that can be.
POSL (Principles of Software Languages) Gr. Kyushu Institute of Technology, Japan 1 A Verification Mechanism for Weaving.
POSL (Principles of Software Languages) Gr. Kyushu Institute of Technology, Japan 1 A Reflective Aspect-oriented Model.
aspectj tools new and noteworthy Mik Kersten University of British Columbia Adrian Colyer IBM Hursley OOPSLA, October
1 Separation of Context Concerns --- Applying Aspect Orientation to VDM Naoyasu Ubayashi (Kyushu Institute of Technology) Shin Nakajima (National Institute.
R R R A Brief Introduction to Aspect-Oriented Programming.
CSC450 Software Engineering Devon M. Simmonds University of North Carolina, Wilmington 1.
AspectScope: An Outline Viewer for AspectJ Programs Michihiro Horie, Shigeru Chiba Tokyo Institute of Technology, Japan.
1 An AOP Implementation Framework for Extending Join Point Models Naoyasu Ubayashi(Kyushu Institute of Technology, Japan) Hidehiko Masuhara(University.
1 Aspectual Caml an Aspect-Oriented Functional Language Hideaki Tatsuzawa Hidehiko Masuhara Akinori Yonezawa University of Tokyo.
AspectJ Development Tools Mik Kersten University of British Columbia October 28, 2003.
RoleEP: Role Based Evolutionary Programming for Cooperative Mobile Agent Applications Naoyasu UBAYASHI ( Toshiba Corporation) Tetsuo TAMAI ( University.
An Interface Mechanism for Encapsulating Weaving in Class-based AOP
Modular Software Development for Dealing with Uncertainty
MACS 2005 First International Workshop on the Modeling and Analysis of Concerns in Software Concern Management for Constructing Model Compilers -- Towards.
Aspect-Oriented Programming with the Eclipse AspectJ plug-in
Aspect-oriented programming
An Extensible Contract Verifier for AspectJ
AspectAda Aspect-Oriented Programming for Ada95
Presentation transcript:

1 An Aspect-oriented Weaving Mechanism Based on Component-and-Connector Architecture Naoyasu Ubayashi (Kyushu Institute of Technology) February 12, 2008 Naoyasu Ubayashi, Akihiro Sakai, and Tetsuo Tamai, “An Aspect-oriented Weaving Mechanism Based on Component-and-Connector Architecture”, In ASE’07, pp

POSL Research Group  Aspect-oriented programming  Reflection  Coordination language  Modeling language  Architecture description language (ADL)  Domain-specific language (DSL)  Formal methods 2 Principles of Software Languages

Recent publications  CAiSE 2009 (21st International Conference on Advanced Information Systems) Naoyasu Ubayashi, Genya Otsubo, Kazuhide Noda, and Jun Yoshida: An Extensible Aspect-oriented Modeling Environment (to appear).  ICST 2008 (1st IEEE International Conference on Software Testing, Verification, and Validation) Naoyasu Ubayashi, Jinji Piao, Suguru Shinotsuka, and Tetsuo Tamai: Contract- based Verification for Aspect-oriented Refactoring.  ASE 2007 (22nd IEEE/ACM International Conference on Automated Software Engineering) Naoyasu Ubayashi, Akihiro Sakai, and Tetsuo Tamai: An Aspect-oriented Weaving Mechanism Based on Component-and-Connector Architecture.  ASE 2005 (20th IEEE/ACM International Conference on Automated Software Engineering) Naoyasu Ubayashi, Genki Moriyama, Hidehiko Masuhara, and Tetsuo Tamai: A Parameterized Interpreter for Modeling Different AOP Mechanisms.  ICSE 2005 (27th IEEE/ACM International Conference on Software Engineering) Tetsuo Tamai, Naoyasu Ubayashi, and Ryoichi Ichiyama: An Adaptive Object Model with Dynamic Role Binding. 3

My talk  ASE’07 + Current work 4

5 Aspect-oriented Programming AOP is a programming paradigm in which crosscutting concerns are modularized as aspects. Display updating after (FigureElement fe): (call(void set*(..)) && target(fe) { fe.display.update(fe); } advice pointcut AspectJ Problem A concern considered crosscutting in one situation might be primary in others. It is not desirable to fix a certain concern as either primary or crosscutting. It is not easy to understand software architecture (the overall behavior of a woven program). Problem A concern considered crosscutting in one situation might be primary in others. It is not desirable to fix a certain concern as either primary or crosscutting. It is not easy to understand software architecture (the overall behavior of a woven program).

6 Our research  We provide a new weaving mechanism based on component- and-connector architecture.  We propose a new interface mechanism called Weaving-interface.  We provide a new AOP language called ccJava. ccJava: Class-based Crosscutting language for Java

7 Image of our idea Concern Component (class) Concern Component (class) Concern Component (class) Concern Component (class) weaving I/F connector weaving I/F Concern weaving by connectors Contribution Proposal of Component-based AOP Architectural AOP Towards MDD Our approach is effective for software modularity, evolution, and reuse. Contribution Proposal of Component-based AOP Architectural AOP Towards MDD Our approach is effective for software modularity, evolution, and reuse.

8 Outline 1. Motivation 2. Weaving-interface & ccJava 3. Example programs 4. Implementation 5. Conclusion & Current work

9 1. Motivation

10 Interface in OOP  A client of a class has only to be aware of methods exposed by an interface of the class.  A class can be modified without being aware of the client if the class does not change the interface. client of a class component (class) programmer component (class) programmer interface

11 However, in AOP …  It is not necessarily easy for a programmer to understand the overall behavior of a woven program because a weaving modifies the behavior of a method defined in a class.

12 Our approach – Weaving-interface  A programmer who defines a weaving has only to be aware of weaving- interfaces.  A programmer of the class can change its implementation without being aware of the client if the class conforms to its weaving-interfaces. programmer who connects components component (class) programmer component (class) programmer weaving-interface Component Connector Concern Component (class) Concern Component (class) Concern Component (class) Concern Component (class) weaving I/F connector weaving I/F Component-based AOP Architectural AOP

13 Related work  AAIF: Aspect-aware interface [Kiczales 2005]  Open modules [Aldrich 2005]  Crosscutting programming interface (XPI) [Sullivan 2005] An interface is determined only once the complete system is known Point implements FigureElement void setX(int): DisplayUpdating - after returning DisplayUpdating.change(); Aspects can be woven to only exposed program points. Open modules support crosscutting within only one class. An interface for specifying rules for designing aspects and classes public aspect XPointChange { /* The purpose of … */ pointcut change(): execution(void Point.setX(int)) || … } Our Approach Software Architecture !! Our Approach Software Architecture !!

14 2. Weaving-interface & ccJava

15 Example --- Figure editor interface Shape { public void moveBy(int dx, int dy); } class Point implements Shape { int x, y; public int getX() { return x; } public int getY() { return y; } public void setX(int x) { this.x = x; } public void setY(int y) { this.y = y; } public void moveBy(int dx, int dy) { x += dx; y += dy; } class Line implements Shape { Point p1, p2; public Point getP1() { return p1; } public Point getP2() { return p2; } public void setP1(Point p1) { this.p1 = p1; } public void setP2(Point p2) { this.p2 = p2; } public void moveBy(int dx, int dy) { p1.x += dx; p1.y += dy; p2.x += dx; p2.y += dy; } class Display { public static void update() { /* the detail is ommited */ } } Three concern components are woven together by component and connector architecture based on weaving- interface. Component

16 AO weaving based on component-connector architecture class Display class Point class Line class Logging wDisplaywPointwLine wLogging redraw + change Component Weaving-interface Connector class Point implements Shape { int x, y; public int getX() { return x; } public int getY() { return y; } public void setX(int x) { this.x = x; } public void setY(int y) { this.y = y; } public void moveBy(int dx, int dy) { x += dx; y += dy; } change redraw class Display { public static void update() { } }

17 Weaving-interface in ccJava public w_interface wPoint { pointcut change(): execution(void setX(int)) || execution(void setY(int)) || execution(void moveBy(int, int)); import before(), after() returning, around() : change(); } public w_interface wLine { pointcut change(): execution(void setP1(Point)) || execution(void setP2(Point)) || execution(void moveBy(int, int)); import before(), after() returning, around() : change(); } public w_interface wDisplay { pointcut redraw(): execution(void update()); import before(), after() returning : redraw(); export redraw(); } weave { class Pointimplements wPoint; class Lineimplements wLine; class Displayimplements wDisplay; connect (port1:wDisplay.redraw, port2:{wPoint || wLine}.change) { after() returning : port2 { port1.proceed(); } } ccJava: Class-based Crosscutting language for Java Connector Port Definition Port Connection Coordination Code Weaving-interface Coordination Type Before After Around introduce Connector descriptions depend on only weaving-interfaces. Architecture can be represented by Weaving-interface + connector. Weaving-interface+Connector is a kind of ADL (Architecture Description Language) Weaving-interface+Connector is a kind of ADL (Architecture Description Language)

18 3. Example programs

19 Example (1) --- Method composition public w_interface wColor { pointcut change() : execution(void setColor(int)); export change(); } public w_interface wPoint { pointcut change(): execution(void setX(int)) || execution(void setY(int)) || execution(void moveBy(int, int)); import before(), after() returning, around() : change(); } weave { class Colorimplements wColor; class Pointimplements wPoint; connect(port1:wColor.change, port2:wPoint.change){ around() : port2 { port2.proceed(); port1.proceed();}} } Weaving-interface Connector Color setColor Point setX setY moveBy behavioral composition Component

20 Example (2) --- Class composition (Inter-type declaration) public w_interface wColor { pointcut color_property() : field(int color) || method(void setColor(int))|| method(int getColor()); export color_property(); } public w_interface wColorPoint extends wPoint { pointcut thisClass() : class(this); import introduce() : thisClass(); } weave { class Colorimplements wColor; class Pointimplements wColorPoint; connect(port1:wColor.color_property, port2:wColorPoint.thisClass) { introduce() : port2 from port1; } } Weaving-interface Connector Color setColor getColor Point setX setY moveBy structural composition Component color Point setX setY moveBy setColor getColor color

21 Example (3) --- Software evolution with ccJava class Point implements Shape { int x, y; public int getX() { return x; } public int getY() { return y; } public void setX(int x) { this.x = x; } public void setY(int y) { this.y = y; } public void moveByPlus (int dx, int dy) { x += dx; y += dy; } weave { class Pointimplements wPoint replacing moveBy with moveByPlus; class Lineimplements wLine; class Displayimplements wDisplay; connect(port1:wDisplay.redraw, port2:{wPoint || wLine}.change){ after() returning : port2 { port1.proceed();}} } class Point implements Shape { int x, y; public int getX() { return x; } public int getY() { return y; } public void setX(int x) { this.x = x; } public void setY(int y) { this.y = y; } public void moveBy(int dx, int dy) { x += dx; y += dy; } version 1version 2 Component Connector Weaving-interfaces do not have to be modified ! Renaming

22 Example (4) --- Interface for dealing with multiple classes public w_interface wChange { pointcut change(): execution(void set*(..)) || execution(void moveBy(int, int)); import before(), after() returning, around() : change(); } weave { class Pointimplements wChange; class Lineimplements wChange; class Displayimplements wDisplay; connect(port1:wDisplay.redraw, port2:wChange.change){ after() returning : port2 { port1.proceed(); } } } The scope of the weaving impact is limited to classes that implement wChange. We have only to look at Point and Line. Weaving-interface Connector class Point implements Shape { int x, y; public int getX() { return x; } public int getY() { return y; } public void setX(int x) { this.x = x; } public void setY(int y) { this.y = y; } public void moveBy(int dx, int dy) { x += dx; y += dy; }

23 Evaluation: Expressiveness for crosscutting descriptions NAWNOCNOC/NAW AspectJ (AAIF)122 ccJava as an open module221 ccJava using wildcard122 NAW: number of aspects or weaving-interfaces NOC: number of classes (Point, Line) wPoint wLine wChange Good Weak Good DisplayUpdating Cannot crosscut multiple classes Can crosscut multiple classes

24 Evaluation: Traceability of weaving impact NOCIFWNOIF AspectJ1all aspectsnumber of aspects AAIF1AAIF1 ccJava1weaving-I/Fsnumber of weaving-IFs NOC: number of classes IFW: impact factors for weaving NOIF: number of impact factors number of all aspects > number of implemented weaving-IFs Weak Good Linguistic reasoning is difficult Linguistic reasoning is easy

25 4. Implementation

26 Compiler construction ccJava code (weaving-interface) Java code (class) ccJava parser AspectJ code generator AspectJ code (aspect) Aspect-Factory class generator AspectJ weaver executable program ccJava compiler

27 Generated code aspect wPoint { Display display = new DisplayFactory. getInstance(); pointcut change(): execution(void Point.setX(int)) || execution(void Point.setY(int)) || execution(void Point.moveBy(int, int)); after() returning: change() { display.update(); } } public class DisplayFactory { private static Display instance = new Display(); public static Display getInstance { return instance; } generated aspect generated factory class weave { class Display implements wDisplay factory UserDefinedFactory; /* other definitions are omitted */ } If a programmer wants to define a specific factory class, …

Verifiable AO MDD Not only programming-level but also design-level notion ADL for bridging a gap between architectural design and implementation 28 Architectural Design Weaving-interface Java Designs and verifies an architecture represented by a set of weaving-interfaces (Alloy-based architecture verification) Implements verified weaving interfaces

ccModeler & ccJava 29 Architectural Design Weaving-interface Java ccModeler ccJava Designs and verifies an architecture represented by a set of weaving- interfaces Implements verified weaving interfaces Architecture Design & verification Refinement

30 6. Conclusion & Current ongoing work

31 Conclusion  A new interface mechanism Weaving-interface  A new weaving mechanism based on component-and-connector architecture Flexible Weaving Mechanism !

Current work -- From Weaving-interface to Archface  Archface: architectural interface for bridging a gap between design modeling and implementation  Archface integrates not only design modeling with its implementation but also AO with OO. 32

Example: Observer Pattern 33 Archface Implementation In archface, a collaborative architecture is specified by a set of ports based on the pointcut mechanism. Pointcut-based interface