Mira Mezini Klaus Ostermann Aspect-Oriented Software Development, 2004.

Slides:



Advertisements
Similar presentations
A Brief Introduction to Aspect-Oriented Programming Zhenxiao Yang.
Advertisements

Aspect Oriented Programming. AOP Contents 1 Overview 2 Terminology 3 The Problem 4 The Solution 4 Join point models 5 Implementation 6 Terminology Review.
ASTA Aspect Software Testing Assistant Juha Gustafsson, Juha Taina, Jukka Viljamaa University of Helsinki.
Secure Systems Research Group - FAU Aspect Oriented Programming Carlos Oviedo Secure Systems Research Group.
Aspect-Oriented Programming: An Overview Brandon Wirick Feb
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.
1 Introduction to CS Agenda Syllabus Schedule Lecture: the management of complexity.
Mira Mezini Klaus Ostermann Aspect-Oriented Software Development, 2004.
Programming Languages and Paradigms Object-Oriented Programming.
Outline Introduction Problem Statement Object-Oriented Design Aspect-Oriented Design Conclusion Demo.
“is a”  Define a new class DerivedClass which extends BaseClass class BaseClass { // class contents } class DerivedClass : BaseClass { // class.
OOPs Object oriented programming. Based on ADT principles  Representation of type and operations in a single unit  Available for other units to create.
1 N Degrees of Separation: Multi-Dimensional Separation of Concern (MDSOC) HyperJ: language and concepts of general concern combination.
Introduction to Aspect Oriented Programming Presented By: Kotaiah Choudary. Ravipati M.Tech IInd Year. School of Info. Tech.
Spring core v3.x Prepared by: Nhan Le. History v3.0 Spring Expression Language Java based bean metadata v3.1 Cache Abstraction Bean Definition Profile.
Aspect Oriented Programming Razieh Asadi University of Science & Technology Mazandran Babol Aspect Component Based Software Engineering (ACBSE)
Integrating Independent Components with On-Demand Remodularization based on OOPSLA 2002 paper by Mira Mezini Klaus Ostermann Prepared by Karl Lieberherr.
Modularizing Web Services Management with AOP María Agustina Cibrán, Bart Verheecke { Maria.Cibran, System and Software Engineering.
Aspect Oriented Programming Sumathie Sundaresan CS590 :: Summer 2007 June 30, 2007.
POSL (Principles of Software Languages) Gr. Kyushu Institute of Technology, Japan Pointcut-based Architectural Interface.
Aspect Oriented Programming Gülşah KARADUMAN.
Methodology: The AOP Refactoring Process Aspect-Oriented Refactoring of the Apache Cocoon Shared-Object Resource Allocation System Jeff Dalton Advisor:
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.
An Adaptive Object Model with Dynamic Role Binding Tamai, T. (U. Tokyo), Ubayashi, N. (Kyushu Inst. Tech.), Ichiyama, R. (U. Tokyo)
AOP-1 Aspect Oriented Programming. AOP-2 Aspects of AOP and Related Tools Limitation of OO Separation of Concerns Aspect Oriented programming AspectJ.
Introduction Better Faster Cheaper (pick any two) On-going issue that continues to motivate research in software engineering Applications: –continue to.
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.
Adaptive Software Kevin Cella Graduate Seminar 02/04/2005.
Introducing Allors Applications, Tools & Platform.
© Siemens AG, CT SE 2 C O R P O R A T E T E C H N O L O G Y 1 Model-Driven Development for Pluggable Collaborations Iris Groher, Stephan Bleicher, Christa.
Summing Up Object Oriented Design. Four Major Components: Abstraction modeling real-life entities by essential information only Encapsulation clustering.
Demeter Aspects We study techniques for the emerging area of Aspect-Oriented Software Development and focus on the following areas:  Aspectual Collaborations.
Lecture 10 Concepts of Programming Languages Arne Kutzner Hanyang University / Seoul Korea.
Inheritance. Inheritance - Introduction Idea behind is to create new classes that are built on existing classes – you reuse the methods and fields and.
Object-Oriented Programming Chapter Chapter
Alloy-based Lightweight Verification for Aspect-oriented Architecture Naoyasu Ubayashi(Kyushu Institute of Technology) Yuki Sato(Kyushu Institute of Technology)
OOPs Object oriented programming. Abstract data types  Representationof type and operations in a single unit  Available for other units to create variables.
ISBN Object-Oriented Programming Chapter Chapter
Interfaces F What is an Interface? F Creating an Interface F Implementing an Interface F What is Marker Interface?
问题 Code scattering Blocks of duplicated code Blocks of complementary code, and different modules implementing complementary parts of the concern Code.
aspectj tools new and noteworthy Mik Kersten University of British Columbia Adrian Colyer IBM Hursley OOPSLA, October
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.
Author: DoanNX Time: 45’.  OOP concepts  OOP in Java.
Testing in OO Environment The reasons for testing is not any different for any of the design and implementation methodologies, including OO methodology.
 Description of Inheritance  Base Class Object  Subclass, Subtype, and Substitutability  Forms of Inheritance  Modifiers and Inheritance  The Benefits.
C++ General Characteristics: - Mixed typing system - Constructors and destructors - Elaborate access controls to class entities.
CSC 243 – Java Programming, Spring, 2014 Week 4, Interfaces, Derived Classes, and Abstract Classes.
ISBN Chapter 12 Support for Object-Oriented Programming.
CSC 243 – Java Programming, Fall, 2008 Tuesday, September 30, end of week 5, Interfaces, Derived Classes, and Abstract Classes.
Modern Programming Tools And Techniques-I
An Interface Mechanism for Encapsulating Weaving in Class-based AOP
Aspect-Oriented Generation of the API Documentation for AspectJ
Aspect-Oriented Programming with the Eclipse AspectJ plug-in
Discussion with Gregor Kiczales at UBC
INTRODUCTION TO OBJECT-ORIENTED PROGRAMMING (OOP) & CONCEPTS
Demeter Aspects Who We Are Aspectual Collaborations
Object Oriented Analysis and Design
Java Programming Language
Packages and Interfaces
A Brief Introduction to Aspect-Oriented Programming
More Object-Oriented Programming
Inheritance Inheritance is a fundamental Object Oriented concept
Lecture 10 Concepts of Programming Languages
Presentation transcript:

Mira Mezini Klaus Ostermann Aspect-Oriented Software Development, 2004

Outline Caesar 3. The Caesar Model -The observer pattern in Caesar. -Related work. 1. Requirements on Language Support 2. JPI: Joint Point Interception approach observer design pattern - The “observer design pattern”. - JPI deficiencies.

Relevant Concepts: “Tyranny of the dominant decomposition”. Cross-cutting models/concerns. Code scattering and tangling. JPI: the Joint-Point Interception approach.

Requirements on Language Support 1.Multi-Abstraction Aspect Modules 2.Aspect Composition 3.Reuse of Aspect Implementation and Bindings 4.Aspectual Polymorphism

Joint Point Interception  JPI approach has disadvantages.  JPIs are still the main primitives of AOP.  Higher level constructs are to be added on top of JPIs and advices. observer pattern The problems with JPI are presented through the observer pattern in AspectJ.

A Graphics Software System Point … …… Shape Line Screen observer pattern The observer pattern 1 Observer Subject Abstract Observer Observer Subject Color Observer

observer pattern The observer pattern 2 public abstract aspect ObserverProtocol { protected interface Subject { } protected interface Observer { } private WeakHashMap perSubjectObservers; protected List getObservers(Subject s) { if (perSubjectObservers == null) perSubjectObservers = new WeakHashMap(); List observers = (List) perSubjectObservers.get(s); if ( observers == null ) { observers = new LinkedList(); perSubjectObservers.put(s, observers); } return observers; } … Declaring an abstract aspect public abstract aspect ObserverProtocol { protected interface Subject { } protected interface Observer { } private WeakHashMap perSubjectObservers; protected List getObservers(Subject s) { if (perSubjectObservers == null) perSubjectObservers = new WeakHashMap(); List observers = (List) perSubjectObservers.get(s); if ( observers == null ) { observers = new LinkedList(); perSubjectObservers.put(s, observers); } return observers; } … Marker Interfaces public abstract aspect ObserverProtocol { protected interface Subject { } protected interface Observer { } private WeakHashMap perSubjectObservers; protected List getObservers(Subject s) { if (perSubjectObservers == null) perSubjectObservers = new WeakHashMap(); List observers = (List) perSubjectObservers.get(s); if ( observers == null ) { observers = new LinkedList(); perSubjectObservers.put(s, observers); } return observers; } … Hash Field public abstract aspect ObserverProtocol { protected interface Subject { } protected interface Observer { } private WeakHashMap perSubjectObservers; protected List getObservers(Subject s) { if (perSubjectObservers == null) perSubjectObservers = new WeakHashMap(); List observers = (List) perSubjectObservers.get(s); if ( observers == null ) { observers = new LinkedList(); perSubjectObservers.put(s, observers); } return observers; } … Allocating a List of Observers for any Subject public abstract aspect ObserverProtocol { protected interface Subject { } protected interface Observer { } private WeakHashMap perSubjectObservers; protected List getObservers(Subject s) { if (perSubjectObservers == null) perSubjectObservers = new WeakHashMap(); List observers = (List) perSubjectObservers.get(s); if ( observers == null ) { observers = new LinkedList(); perSubjectObservers.put(s, observers); } return observers; } …

observer pattern The observer pattern 3 Adding and removing observers … public void addObserver(Subject s,Observer o){ getObservers(s).add(o); } public void removeObserver(Subject s,Observer o){ getObservers(s).remove(o); } abstract protected void updateObserver(Subject s, Observer o); abstract protected pointcut subjectChange(Subject s); after(Subject s) : subjectChange(s) { Iterator iter = getObservers(s).iterator(); while ( iter.hasNext() ) updateObserver(s, ((Observer)iter.next())); } Abstract members … public void addObserver(Subject s,Observer o){ getObservers(s).add(o); } public void removeObserver(Subject s,Observer o){ getObservers(s).remove(o); } abstract protected void updateObserver(Subject s, Observer o); abstract protected pointcut subjectChange(Subject s); after(Subject s) : subjectChange(s) { Iterator iter = getObservers(s).iterator(); while ( iter.hasNext() ) updateObserver(s, ((Observer)iter.next())); } … public void addObserver(Subject s,Observer o){ getObservers(s).add(o); } public void removeObserver(Subject s,Observer o){ getObservers(s).remove(o); } abstract protected void updateObserver(Subject s, Observer o); abstract protected pointcut subjectChange(Subject s); after(Subject s) : subjectChange(s) { Iterator iter = getObservers(s).iterator(); while ( iter.hasNext() ) updateObserver(s, ((Observer)iter.next())); } Advice … public void addObserver(Subject s,Observer o){ getObservers(s).add(o); } public void removeObserver(Subject s,Observer o){ getObservers(s).remove(o); } abstract protected void updateObserver(Subject s, Observer o); abstract protected pointcut subjectChange(Subject s); after(Subject s) : subjectChange(s) { Iterator iter = getObservers(s).iterator(); while ( iter.hasNext() ) updateObserver(s, ((Observer)iter.next())); }

public aspect ColorObserver extends ObserverProtocol{ declare parents: Point implements Subject; declare parents: Line implements Subject; declare parents: Screen implements Observer; protected pointcut subjectChange(Subject s) : ( call ( void Point.setColor(Color)) || call ( void Line.setColor(Color)) ) && target(s); protected void updateObserver(Subject s, Observer o) { ((Screen)o).display("Color change."); } observer pattern The observer pattern 4 public aspect ColorObserver extends ObserverProtocol{ declare parents: Point implements Subject; declare parents: Line implements Subject; declare parents: Screen implements Observer; protected pointcut subjectChange(Subject s) : ( call ( void Point.setColor(Color)) || call ( void Line.setColor(Color)) ) && target(s); protected void updateObserver(Subject s, Observer o) { ((Screen)o).display("Color change."); } Mark Base Classes public aspect ColorObserver extends ObserverProtocol{ declare parents: Point implements Subject; declare parents: Line implements Subject; declare parents: Screen implements Observer; protected pointcut subjectChange(Subject s) : ( call ( void Point.setColor(Color)) || call ( void Line.setColor(Color)) ) && target(s); protected void updateObserver(Subject s, Observer o) { ((Screen)o).display("Color change."); } Pointcuts Impl. public aspect ColorObserver extends ObserverProtocol{ declare parents: Point implements Subject; declare parents: Line implements Subject; declare parents: Screen implements Observer; protected pointcut subjectChange(Subject s) : ( call ( void Point.setColor(Color)) || call ( void Line.setColor(Color)) ) && target(s); protected void updateObserver(Subject s, Observer o) { ((Screen)o).display("Color change."); } Aspect Impl. public aspect ColorObserver extends ObserverProtocol{ declare parents: Point implements Subject; declare parents: Line implements Subject; declare parents: Screen implements Observer; protected pointcut subjectChange(Subject s) : ( call ( void Point.setColor(Color)) || call ( void Line.setColor(Color)) ) && target(s); protected void updateObserver(Subject s, Observer o) { ((Screen)o).display("Color change."); } Update Impl.

observer pattern The observer pattern 5 Two primary advantages: 1.Reusability  Implementationbinding  Implementation is separated from binding  Implementation is reusable. 2.Independent Extensibility  Subject can be mapped to many classes.  A class can be assigned many roles.  The same role can be assigned to the same class in different bindings.

Lack of Support for: Multiabstraction Aspects No separation of concerns in the aspect: –Contains all methods of all abstractions defined in it. Contradicts OOP and AOP. –Fields and inheritance for the abstractions? AspectJ’s introduction mechanism leads to losing independent extensibility. No dynamic dispatch.

Lack of support for: Sophisticated Mapping Each abstraction must be mapped directly to some base class. This is not always the case: –Consider a graph aspect, defined in terms of Node and Edge. –An application in which every Point has a collection of adjacent points. –Edge cannot be mapped to any base class.

ObserverProtocol ColorObserver Software Lack of support for: Reusable Aspect Bindings Every aspect binding is coupled to one particular aspect implementation. LocationObserver ColorObserver 1 ColorObserver 2 ObserverProtocol Software

Lack of support for: Aspectual Polymorphism Once the aspect is compiled together with the target package, the changes in the execution are determined. It is not possible to determine at runtime which implementation of the aspect to apply.

The Caesar Model 1 ACIACI - Aspect Collaboration Interface: An interface definition for aspects with multiple mutually recursive nested types An interface definition for aspects with multiple mutually recursive nested types. implementationsbindingsThe purpose of ACI: decoupling aspect implementations and aspect bindings. The modules are independently defined, but are indirectly connected.

The Caesar Model 2 A Software System … Observer Subject Observer ACI Observer Subject Color Observer

Aspect Collaboration Interfaces 1 interface ObserverProtocol { interface Subject { provided void addObserver(Observer o); provided void removeObserver(Observer o); provided void changed(); expected String getState(); } interface Observer { expected void notify(Subject s); } Nested Subject Interface interface ObserverProtocol { interface Subject { provided void addObserver(Observer o); provided void removeObserver(Observer o); provided void changed(); expected String getState(); } interface Observer { expected void notify(Subject s); } Expected Method interface ObserverProtocol { interface Subject { provided void addObserver(Observer o); provided void removeObserver(Observer o); provided void changed(); expected String getState(); } interface Observer { expected void notify(Subject s); } Provided Methods interface ObserverProtocol { interface Subject { provided void addObserver(Observer o); provided void removeObserver(Observer o); provided void changed(); expected String getState(); } interface Observer { expected void notify(Subject s); } Nested Observer Interface interface ObserverProtocol { interface Subject { provided void addObserver(Observer o); provided void removeObserver(Observer o); provided void changed(); expected String getState(); } interface Observer { expected void notify(Subject s); } Abstract Observer Aspect interface ObserverProtocol { interface Subject { provided void addObserver(Observer o); provided void removeObserver(Observer o); provided void changed(); expected String getState(); } interface Observer { expected void notify(Subject s); }

The ObserverProtocol ACI has 2 nested, mutually recursive, ACIs. Determines impl./bindings relations: –provided: what the aspect should provide. –expected: required from the binding. The provided & expected facets are implemented in different modules. However, They are indirectly connected through the ACI. Aspect Collaboration Interfaces 2

What do we gain? 1.An abstract aspect. 2.Aspect-related Interfaces that are “aware” of each other and can collaborate. 3.A modularization of the problem. 4.No binding-specific members. Aspect Collaboration Interfaces 3

Aspect Implementations 1 providedAn aspect implementation must implement all the provided methods. The implementation class structure is the same as of the ACI structure. provided expectedThe implementation of the provided methods can call the expected methods.

class ObserverProtocolImpl implements ObserverProtocol { class Subject { List observers = new LinkedList(); void addObserver(Observer o) { observers.add(o);} void removeObserver(Observer o) { observers.remove(o); } void changed() { Iterator iter = observers.iterator(); while ( iter.hasNext() ) ((Observer)iter.next()).notify(this); } Provided Methods class ObserverProtocolImpl implements ObserverProtocol { class Subject { List observers = new LinkedList(); void addObserver(Observer o) { observers.add(o);} void removeObserver(Observer o) { observers.remove(o); } void changed() { Iterator iter = observers.iterator(); while ( iter.hasNext() ) ((Observer)iter.next()).notify(this); } A Nested Class class ObserverProtocolImpl implements ObserverProtocol { class Subject { List observers = new LinkedList(); void addObserver(Observer o) { observers.add(o);} void removeObserver(Observer o) { observers.remove(o); } void changed() { Iterator iter = observers.iterator(); while ( iter.hasNext() ) ((Observer)iter.next()).notify(this); } Observer Aspect class ObserverProtocolImpl implements ObserverProtocol { class Subject { List observers = new LinkedList(); void addObserver(Observer o) { observers.add(o);} void removeObserver(Observer o) { observers.remove(o); } void changed() { Iterator iter = observers.iterator(); while ( iter.hasNext() ) ((Observer)iter.next()).notify(this); } Aspect Implementations 2

What do we gain? Observeraspects 1.Many kinds of Observer aspects, with a common interface. 2.A modularization of the aspect. 3.No need for “global” members. 4.Still no binding-specific members. Aspect Implementations 3

Aspect Bindings 1 expectedAn aspect binding implements all the expected methods in the ACI. For each nested ACI there may be zero,one, or more nested bindings. wrappersBase objects are accessed through wrappers.

Aspect Bindings 2 class ColorObserver binds ObserverProtocol { class PointSubject binds Subject wraps Point { String getState() { return "Point colored "+wrappee.getColor()}} } class LineSubject binds Subject wraps Line { String getState() { return "Line colored "+wrappee.getColor(); } } class ScreenObserver binds Observer wraps Screen { void notify(Subject s) {wrappee.display("Color changed: "+s.getState());} } after(Point p): (call(void p.setColor(Color))){ PointSubject(p).changed(); } after(Line l): (call(void l.setColor(Color))){ LineSubject(l).changed(); } } Advices class ColorObserver binds ObserverProtocol { class PointSubject binds Subject wraps Point { String getState() { return "Point colored "+wrappee.getColor()}} } class LineSubject binds Subject wraps Line { String getState() { return "Line colored "+wrappee.getColor(); } } class ScreenObserver binds Observer wraps Screen { void notify(Subject s) {wrappee.display("Color changed: "+s.getState());} } after(Point p): (call(void p.setColor(Color))){ PointSubject(p).changed(); } after(Line l): (call(void l.setColor(Color))){ LineSubject(l).changed(); } } A “ Binding ” class ColorObserver binds ObserverProtocol { class PointSubject binds Subject wraps Point { String getState() { return "Point colored "+wrappee.getColor()}} } class LineSubject binds Subject wraps Line { String getState() { return "Line colored "+wrappee.getColor(); } } class ScreenObserver binds Observer wraps Screen { void notify(Subject s) {wrappee.display("Color changed: "+s.getState());} } after(Point p): (call(void p.setColor(Color))){ PointSubject(p).changed(); } after(Line l): (call(void l.setColor(Color))){ LineSubject(l).changed(); } } Binding of Observer class ColorObserver binds ObserverProtocol { class PointSubject binds Subject wraps Point { String getState() { return "Point colored "+wrappee.getColor()}} } class LineSubject binds Subject wraps Line { String getState() { return "Line colored "+wrappee.getColor(); } } class ScreenObserver binds Observer wraps Screen { void notify(Subject s) {wrappee.display("Color changed: "+s.getState());} } after(Point p): (call(void p.setColor(Color))){ PointSubject(p).changed(); } after(Line l): (call(void l.setColor(Color))){ LineSubject(l).changed(); } } Binding of Subject class ColorObserver binds ObserverProtocol { class PointSubject binds Subject wraps Point { String getState() { return "Point colored "+wrappee.getColor()}} } class LineSubject binds Subject wraps Line { String getState() { return "Line colored "+wrappee.getColor(); } } class ScreenObserver binds Observer wraps Screen { void notify(Subject s) {wrappee.display("Color changed: "+s.getState());} } after(Point p): (call(void p.setColor(Color))){ PointSubject(p).changed(); } after(Line l): (call(void l.setColor(Color))){ LineSubject(l).changed(); } }

What do we gain? 1.Interface can be bound in many ways. 2.A “Binding” is a module. 3.No need for “global” members. 4.No aspect-implementation specific details. Aspect Bindings 3

Wrapper Recycling Avoiding multiple wrappers for the same base object. Access to a base object is done through the wrapper: outerClassInstance.Wrapper(constructor_args) A wrapper may wrap a set of objects.

Most Specific Wrappers 1 A mechanism that determines the most specific wrapper for an object based on the object’s runtime type, when multiple nested binding classes with the same name are available.

Most Specific Wrappers 2 class MovableFigures { class MovableFigure implements Movable wraps Figure { void moveBy(int x, int y) {}; } class MovableFigure implements Movable wraps Point { void moveBy(int x, int y) { wrappee.setX(wrappee.getX()+x); wrappee.setY(wrappee.getY()+y); } class MovableFigure implements Movable wraps Line { void moveBy(int x, int y) { MovableFigure(wrappee.getP1()).moveBy(x,y); MovableFigure(wrappee.getP2()).moveBy(x,y); }

Most Specific Wrappers 3 class Test { MovableFigures mv = new MovableFigures(); void move(Figure f) { mv.MovableFigure(f).moveBy(5,7); } On a constructor/wrapper call, the dynamic type of the argument determines the actual nested binding to instantiate/recycle.

Pointcuts and Advices Supported similarly to AspectJ Part of the modular ACIs. A binding must be explicitly deployed. The difference: Compilation with pointcuts and advices does not change the base class semantics Compilation with pointcuts and advices does not change the base class semantics.

Weavelets and Deployment Weavelet: a composition of an implementation and a binding. A weavelet has to be deployed in order to activate its pointcuts and advices. class CO extends ObserverProtocol {};

Weavelets 2 What do we gain? Reusable aspect bindings. Reusable aspect implementations. class CO1 extends ObserverProtocol {}; class CO2 extends ObserverProtocol {}; class CO3 extends ObserverProtocol {}; class Obs1 extends ObserverProtocol {}; class Obs2 extends ObserverProtocol {}; class Obs3 extends ObserverProtocol {};

Static Deployment 1 Pointcuts and advices of co weavelet are engaged only if it is deployed. Deployment takes place at loading time of Test. class Test... { deploy deploy public static final CO co = new CO();... }

Static Deployment 2 Weavelet access. Objects are accessed through the wrappers mechanism. class Test{ deploy deploy public static final CO co = new CO(); void register(Point p, Screen s){ co.PointSubject(p).addObserver( co.ScreenObserver(s) ); }

Dynamic Deployment 1 It is possible to decide dynamically which aspect implementation to deploy. class Logging { after(): (call(void Point.setX(int)) || call(void Point.setY(int)) ) { System.out.println("Coordinates changed"); } class VerboseLogging extends Logging { after(): (call(void Point.setColor(Color)) { System.out.println("Color changed"); }

Dynamic Deployment 2 class Main { public static void main(String args[]) { Logging log = null; Point p[] = createSamplePoints(); if (args[0].equals("-log")) log = new Logging(); else if (args[0].equals("-verbose")) log = new VerboseLogging(); deploy (l) { modify(p); } } public static void modify(Point p[]) { p[3].setX(5); p[2].setColor(Color.RED); } What is the type of log ? class Main { public static void main(String args[]) { Logging log = null; Point p[] = createSamplePoints(); if (args[0].equals("-log")) log = new Logging(); else if (args[0].equals("-verbose")) log = new VerboseLogging(); log = new VerboseLogging(); deploy (l) { modify(p); } } public static void modify(Point p[]) { p[3].setX(5); p[2].setColor(Color.RED); }

Virtual Classes and Static Typing All nested interfaces of a CI and all classes that implement or bind such interfaces, are virtual types/classes Compatible with Java’s approach.

Caesar vs. Hyper/J hyperslices hypermoduleHyper/J: Independent hyperslices, integrated by composition rules (hypermodule). Class-based. Can’t change individual objects. Lacks CI’s and reusable bindings: either the modules are independent, or composition becomes very complex. Composition language is not OO enough.

Caesar vs. Composition Filters CFs: filters for object’s in/out messages. Integration through join points. CF have no mechanism for separating aspect implementation from aspect bindings. No aspectual polymorphism. CFs are more declarative: good for some kinds of concerns.

Current Status in caesarj.org “Very active on-going research”. The AORTA project. Industry: in –Applying aspect-oriented programming in commercial software development

Conclusions JPI alone does not suffice for a modular structuring of aspects, resulting in tangled aspect code. Caesar enables: –Componentization of aspects. –Reusability of aspects bindings & implementations. –Polymorphic aspects usage. –Dynamic aspect deployment. Caesar is based on the notion of an ACI ACIs can be applied to support a more modular structuring of aspect code and better aspect reuse.