Aspects at the Design Level

Slides:



Advertisements
Similar presentations
Aspect Oriented Programming. AOP Contents 1 Overview 2 Terminology 3 The Problem 4 The Solution 4 Join point models 5 Implementation 6 Terminology Review.
Advertisements

ASTA Aspect Software Testing Assistant Juha Gustafsson, Juha Taina, Jukka Viljamaa University of Helsinki.
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.
University of British Columbia Software Practices Lab 2005 CASCON A Fluid AOP Editor Terry Hon Gregor Kiczales.
1 Aspect Oriented Programming Programming Languages Seminar Presenter: Barış Aktemur University of Illinois 18 Feb Mostly taken from Bedir Tekinerdogan’s.
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.
Software modularity group Gregor Kiczales Professor and NSERC/Xerox/Sierra Systems Software Design Chair University of British Columbia Principal Scientist.
ACM/JETT Workshop - August 4-5, 2005 UML Modeling using MagicDraw UML for Java Programmers.
1 Model Interface Implementation for Two-Way Obliviousness in Aspect-Oriented Modeling Presented by Wuliang Sun Department of Computer Science Baylor 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
Outline Introduction Problem Statement Object-Oriented Design Aspect-Oriented Design Conclusion Demo.
3/7/2003Bioinformatics1 How To Address Rapidly Changing Data Representations in an Evolving Scientific Domain Using Aspect-oriented Programming Techniques.
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.
1 An Aspect-oriented Weaving Mechanism Based on Component-and-Connector Architecture Naoyasu Ubayashi (Kyushu Institute of Technology) February 12, 2008.
©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 32 Slide 1 Aspect-oriented Software Development 1.
Expression evaluation E : S | C. S = int. C = Op E E. Op : A | M. A = “+”. M = “*”.
Modularizing Web Services Management with AOP María Agustina Cibrán, Bart Verheecke { Maria.Cibran, System and Software Engineering.
1 Model Compiler Construction Based on Aspect-oriented Mechanisms Naoyasu Ubayashi (Kyushu Institute of Technology) Tetsuo Tamai (University of Tokyo)
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 Pointcut-based Architectural Interface.
Aspect Oriented Programming Gülşah KARADUMAN.
Slides for Gregor Kiczales Two versions –short version: Crosscutting capabilities for Java and AspectJ through DJ (4 viewgraphs only) –long version: Controlling.
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.
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
IDENTIFYING SEMANTIC DIFFERENCES IN ASPECTJ PROGRAMS Martin Görg and Jianjun Zhao Computer Science Department, Shanghai Jiao Tong University.
Aspect-Oriented Action Semantics Descriptions Luis Menezes University of Pernambuco
Topics for exam in AOSD Basic concepts: tangling, scattering, joinpoint, advice, cross-cutting, weaving AspectJ: syntax, pointcut notations, around, proceed,
Demeter Aspects We study techniques for the emerging area of Aspect-Oriented Software Development and focus on the following areas:  Aspectual Collaborations.
Aspect Oriented Development Alex Beatty.  Purpose  Cross-cutting Concerns  Join Points, Pointcuts, and Advices  Weaving  Invasive vs. Non-Invasive.
Alloy-based Lightweight Verification for Aspect-oriented Architecture Naoyasu Ubayashi(Kyushu Institute of Technology) Yuki Sato(Kyushu Institute of Technology)
aspectj tools new and noteworthy Mik Kersten University of British Columbia Adrian Colyer IBM Hursley OOPSLA, October
Applying Aspect-Orientation in Designing Security Systems Shu Gao Florida International University Center for Advanced Distributed Systems Engineering.
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.
UBC software modularity group 1/14/02 UCSD1 Discussion with Kiczales at UBC Ontology of AOP Ontology is the study of what there is, an inventory of what.
University of British Columbia Software Practices Lab Uniform Support for Modeling Crosscutting Structure Maria Tkatchenko Gregor Kiczales Work supported.
1 An AOP Implementation Framework for Extending Join Point Models Naoyasu Ubayashi(Kyushu Institute of Technology, Japan) Hidehiko Masuhara(University.
AO Mechanisms in Demeter1 Discussion with Gregor Kiczales at UBC Ontology of AOP Ontology is the study of what there is, an inventory of what exists. An.
Talk only to your friends that share the same concerns (Law of Demeter for Concerns) Midterm Review February 2004.
Aspect-oriented Code Generation Approaches Abid Mehmood & Dayang N. A. Jawawi Department of Software Engineering Faculty of Computer Science and Information.
Software Engineering Lecture 7
An Interface Mechanism for Encapsulating Weaving in Class-based AOP
Crosscutting Capabilities for Java and AspectJ through DJ
MACS 2005 First International Workshop on the Modeling and Analysis of Concerns in Software Concern Management for Constructing Model Compilers -- Towards.
Mastering UML with Rational Rose 2002
Aspect-Oriented Generation of the API Documentation for AspectJ
Structure and Interpretation of an Aspect Language for Datatype
Aspect-Oriented Programming with the Eclipse AspectJ plug-in
Discussion with Gregor Kiczales at UBC
Demeter Aspects Who We Are Aspectual Collaborations
Software Design and Development
ADAPTIVE PROGRAMMING Sezen ERDEM December 2005.
Software Design and Development
A Brief Introduction to Aspect-Oriented Programming
Distributed Dynamic Weaving is a Crosscutting Concern
Lecture 21: Crosscutting Aspect-Oriented Programming Background
Aspect-oriented programming
Copyright 2007 Oxford Consulting, Ltd
Software Development CSU 670 Karl Lieberherr
AspectAda Aspect-Oriented Programming for Ada95
Karl Lieberherr Doug Orleans
Presentation transcript:

Aspects at the Design Level 2003. 05. 21. SNU., RTOSLAB. Jiyong Park

Contents Modeling Aspect Mechanisms Representing aspect in UML The big picture of our framework Limitations of existing methods Proposed better methods Conclusion

Modeling Aspect Mechanisms Modular Crosscutting in Aspect-Oriented Mechanisms Hidehiko Masuhara – University of Tokyo Gregor Kiczales – University of British Columbia ECOOP 2003

Contents Brief descriptions of four aspect mechanisms Pointcut, Advice Traversal Specification Class hierarchy composition Open class Model of each mechanisms

Four Different Aspect Mechanisms Pointcut, Advice – AspectJ Traversal specification – Demeter, DemeterJ, DJ Class hierarchy composition – Hyper/J Open class – AspectJ

Pointcut, Advice execute display.update() whenever after set*() is called Figure FigureElement 1 * elements: List display: Display Point Line x: int y: int 2 p1: Point p2: Point getX(void): int getY(void): int setX(int x): void setY(int x): void getX(void): int getY(void): int setP1(Point p1): void setP2(Point p2): void

Pointcut, Advice Advice: additional implementation Pointcut: the location that the advice is to be inserted after (FigureElement fe): call(void FigureElement+.set*(..)) && target(fe) { fe.display.update(fe); } Figure FigureElement 1 * elements: List display: Display Point Line x: int y: int 2 p1: Point p2: Point getX(void): int getY(void): int setX(int x): void setY(int x): void getX(void): int getY(void): int setP1(Point p1): void setP2(Point p2): void DisplayUpdating after(): call(void FigureElement+.set*(..)) || call(void FigureElement.moveBy(int, int)) { Display.update(); }

Traversal Specification find all persons waiting at any bus stop on a bus route busStops BusRoute BusStopList OO solution: one method for each green class buses 0..* BusStop BusList waiting 0..* passengers PersonList Bus Person 0..*

Traversal Specification from BusRoute through BusStop to Person busStops BusRoute BusStopList buses 0..* BusStop BusList waiting 0..* passengers PersonList Bus Person 0..*

Traversal Specification Build a object graph (based on reachability) at runtime Traversal specifiction: where to navigate Visitor: what to do before and after certain object is visited String WPStrategy=“from BusRoute through BusStop to Person” // Prepare the traversal for the current class graph ClassGraph classGraph = new ClassGraph(); TraversalGraph WPTraversal = new TraversalGraph (WPStrategy, classGraph); int r = aBusRoute.countPersons(WPTraversal);

Traversal Specification root of the traversal class BusRoute { int countPersons(TraversalGraph WP) { Integer result = (Integer) WP.traverse(this, new Visitor(){ int r; public void before(Person host){ r++; } public void start() { r = 0;} public Object getReturnValue(){return new Integer(r);} } ); return result.intValue();

Traversal Specification DJ Java Library (uses Reflection) Enables aspect programming in pure Java By Northeastern University

Class Hierarchy Composition Meta-Program (How to weave) Source A Source A+B weaver Source B

bracket “{Point,Line}”.”set*” after Observable.moved($OperationName); Program A Program B Figure FigureElement 1 * elements: List display: Display Point Line Observable x: int y: int 2 p1: Point p2: Point display: Display moved(): void { display.update(); } getX(void): int getY(void): int setX(int x): void setY(int x): void getX(void): int getY(void): int setP1(Point p1): void setP2(Point p2): void Meta-Program mergeByName; bracket “{Point,Line}”.”set*” after Observable.moved($OperationName);

Open Class Locate method or field declaration outside the textual body of the class declarion Synonym introduction (by AspectJ) inter-type declaration Common use Solve versions of the visitor problem class DisplayMethods { void Point.draw() { Graphics.drawOval(…);} void Line.draw() { Graphics.drawLine(…);} }

What is crosscutting structure ? program A and B crosscut each other = set of join points identified by program A and B is not a subset of the other Program A Weaved Program Program B join point

Modeling Framework <X, XJP, A, AID, AEFF, AMOD, B, BID, BEFF, BMOD, META> A, B: language that input program is written X: result of domain weaving process XJP: join points in X AID, BID: means of identifying join points AEFF, BEFF: means of effecting semantics at identified join points AMOD: BMOD: units of modularity META: optional meta-language for parameterizing the weaving process Program A Weaver Program X Program B Meta program

Modeling Framework kind of join points kind of join points

Pointcut, Advice class aspect execution method call field set/get object instantiated

Traversal Specification object graph class traversal specification & visitor

Class Hierarchy Composition combined program class method declaration field declaration class declaration meta program

Open Class class class open class method declaration field declaration class declaration

Conclusion Pointcut, Advice of AspectJ is most popular But, other mechanisms can give some insight Class hierarchy composition seems to be the most natural way

Our Aspect Weaving Framework

Key Ideas Automatically generate ‘weaver’ described by meta-model transform specification Represent aspects in graphical way

Key Idea 1: How to weave aspect ? metamodel of aspectJ model transformation (aspectJ  Java) metamodel of Java metamodel model aspectJ program aspect weaver Java Program implementation oriented (traditional) approach intermediate stage metamodel of aspect program model tr. generic object metamodel model tr. metamodel of Java metamodel model code gen aspect program Generic object program Java Program design oriented (our) approach

Comparision Limitations of implementation oriented approach Weaver is dependent on language Hard to modify weaving process Our design oriented approach Intermediate model is introduced (generic object program) [generic object program  implemention program] is naïve [aspect program  generic object program], which is weaving process, is graphical

Related Work By Hidehiko Masuhara & Gregor Kiczales

Incorporating Aspects into the UML Mark Basch, Arturo Sanchez Department of Computer and Information Science, University of North Florida International Conference on Aspect-Oriented Software Development (AOSD), 2003 From AOP to UML – A Bottom-Up Approach Mohamed Mancona Kande, Jorg Kienzle and Alfred Strohmeier Software Engineering Laboratory Swiss Federal Institute of Technology Lausanne Workshop on Aspect-Oriented Modeling with UML (as part of the AOSD 2003)

Contents UML is not suitable for model aspect Example Extension to UML

Using UML for OO Modeling Well supported public class Account { private int balance = 0; public void withdraw (int amount) {…}; public void deposit (int amount) {…}; public int getBalance() {…}; } public class Customer { public String name; … a.withdraw(50); } (dynamic structure) (static structure)

Using UML for Aspect-Oriented Modeling Logging aspect: all method calls made by customers on an account object generates logs Not well supported public aspect Logging { private PrintWriter Account.myLog; public void Account.setLog(String fileName) { myLog = new Log(fileName); myLog.println(“This is the logfile for account “+ this); } pointcut MethodCall(Customer c, Account a): call (public * Account.*(..)) && this(c) && target(a); after (Customer c, Account a): MethodCall(c,a) { a.myLog.println(c+” called “+ thisJoinPoint.getSignature().getName()); a.myLog.flush();

Using UML for Aspect-Oriented Modeling

Problems of the Previous Modeling Aspect is scattered throughout the diagrams The two diagrams are inconsistent (Interceptor class) pointcut, introduction, advice are not explicitly modeled …  Abstraction inversion In implementation: logging code is seperated In design: logging design is scattered

Modeling Aspect in UML Extending existing UML Using stereotype, tag, …  Confusing Introduce new modeling element  Clear

Extending Existing UML Designing Aspect-Oriented Crosscutting in UML Dominik Stein, Stefan Hanenberg, and Rainer Unland

Extending Existing UML From AOP to UML – A Bottom-Up Approach Mohamed Mancona Kandé, Jörg Kienzle and Alfred Strohmeier

Extending Existing UML A UML Notation for Aspect-Oriented Software Design Renaud Pawlak, Laurence Duchien, …

Introduce New Modeling Element Incorporating Aspects into the UML Mark Basch, Arturo Sanchez New elements join points aspects

1. Aspect Packages join points are modeled outside of aspect and component package

2. Class Diagrams for Aspects Within aspect package To show which component classes are cross-cut by the aspect

3. Interaction Diagrams for Aspects Interaction between component and aspect

3. Interaction Diagrams for Aspects Sequence inside the aspect

Future Work Bring new UML notation into our framework