Master’s Thesis Defense: Aspectual Concepts John J. Sung.

Slides:



Advertisements
Similar presentations
AspectWerkz 2 - and the road to AspectJ 5 Jonas Bonér Senior Software Engineer BEA Systems.
Advertisements

Chapter 1: Computer Systems
Aspect Oriented Programming. AOP Contents 1 Overview 2 Terminology 3 The Problem 4 The Solution 4 Join point models 5 Implementation 6 Terminology Review.
Chapter 7 User-Defined Methods. Chapter Objectives  Understand how methods are used in Java programming  Learn about standard (predefined) methods and.
1 Shyness in Programming Karl Lieberherr Demeter Research Group Northeastern University Boston.
Secure Systems Research Group - FAU Aspect Oriented Programming Carlos Oviedo Secure Systems Research Group.
Overview of AspectJ Aspect Oriented Software Development Seminar Technion presented by Oren Mishali.
Explaining DJ with AOP. DJ ClassGraph.traverse (this,whereToGo,whatToDo) Intertype declaration Advice.
University of British Columbia Software Practices Lab Fluid AOP Join Point Models Terry Hon Gregor Kiczales.
OOP in Java Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
University of British Columbia Software Practices Lab CAS Seminar 06 Fluid AJ - A Simple Fluid AOP Tool Terry Hon Gregor Kiczales.
Integration of Demeter and AspectJ (DAJ) John J. Sung.
Aspect-Oriented Software Development (AOSD) Tutorial #3 AspectJ - continued.
1 Chapter 8 Objects and Classes. 2 Motivations After learning the preceding chapters, you are capable of solving many programming problems using selections,
1 Model Interface Implementation for Two-Way Obliviousness in Aspect-Oriented Modeling Presented by Wuliang Sun Department of Computer Science Baylor University.
XFindBugs: eXtended FindBugs for AspectJ Haihao Shen, Sai Zhang, Jianjun Zhao, Jianhong Fang, Shiyuan Yao Software Theory and Practice Group (STAP) Shanghai.
Outline Introduction Problem Statement Object-Oriented Design Aspect-Oriented Design Conclusion Demo.
Introduction to Aspect Oriented Programming Presented By: Kotaiah Choudary. Ravipati M.Tech IInd Year. School of Info. Tech.
Java Language and SW Dev’t
Change Impact Analysis for AspectJ Programs Sai Zhang, Zhongxian Gu, Yu Lin and Jianjun Zhao Shanghai Jiao Tong University.
Integrating Independent Components with On-Demand Remodularization based on OOPSLA 2002 paper by Mira Mezini Klaus Ostermann Prepared by Karl Lieberherr.
Extensible Plug-ins for Aspect-Oriented Programming Macneil Shonle*Ankit Shah.
1 Module Objective & Outline Module Objective: After completing this Module, you will be able to, appreciate java as a programming language, write java.
The Java Programming Language
Aspect Oriented Programming Sumathie Sundaresan CS590 :: Summer 2007 June 30, 2007.
Introduction to Software Testing Chapter 8.1 Building Testing Tools –Instrumentation Paul Ammann & Jeff Offutt
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.
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.
Master’s Thesis Defense: Aspectual Concepts John J. Sung.
John J. Sung TA Consulting. Motivation for TraversalJ KL Enterprises identified AOP Enter into the AOP market early Add value by adding traversals to.
1 An Aspect-Oriented Implementation Method Sérgio Soares CIn – UFPE Orientador: Paulo Borba.
Features of AOP languages AOP languages have the following main elements: –a join point model (JPM) wrt base PL –a specification language for expressing.
IDENTIFYING SEMANTIC DIFFERENCES IN ASPECTJ PROGRAMS Martin Görg and Jianjun Zhao Computer Science Department, Shanghai Jiao Tong University.
Adaptive Software Kevin Cella Graduate Seminar 02/04/2005.
1 Functional Visitor Ø Motivation Example Container checking -- Make sure each Container is not overloaded Weight Item + int total( ) w Container + int.
Inter-Type Declarations in AspectJ Awais Rashid Steffen Zschaler © Awais Rashid, Steffen Zschaler 2009.
AspectJ – AOP for Java Tom Janofsky. Instructor at Penn State Abington Consultant with Chariot Solutions JUG Member.
Course Progress Lecture 1 –Java data binding: Basket example: UML class diagram -> class dictionary without tokens-> language design -> class dictionary.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University IWPSE 2003 Program.
Demeter Aspects We study techniques for the emerging area of Aspect-Oriented Software Development and focus on the following areas:  Aspectual Collaborations.
Inheritance. Inheritance - Introduction Idea behind is to create new classes that are built on existing classes – you reuse the methods and fields and.
Checking LoD in AspectJ Show the idea, not the details. How can we precisely express it in a programming language?
Translating Traversals to AspectJ. Outline Motivation Demeter Process for Traversals AspectJ Translation Process.
问题 Code scattering Blocks of duplicated code Blocks of complementary code, and different modules implementing complementary parts of the concern Code.
Comparison of Different AOP Approaches Presented by: Xiaojing Wang.
Classes, Interfaces and Packages
AOP/cross-cutting What is an aspect?. An aspect is a modular unit that cross-cuts other modular units. What means cross-cutting? Apply AOP to AOP. Tease.
CSC450 Software Engineering Devon M. Simmonds University of North Carolina, Wilmington 1.
3 Project Objectives Aspectual Collaborations (AC) for the Connection Aspect –Metric: Does the restructuring of the UAV code with AC reduce the tangling.
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.
COM1205 TraversalJ Project* Pengcheng Wu Feb.25,2003.
AOP with AspectJ Awais Rashid, Steffen Zschaler © Awais Rashid, Steffen Zschaler 2009.
Aspect-Oriented Software Development (AOSD)
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.
Features of AOP languages AOP languages have the following main elements: –a join point model (JPM) wrt base PL –a specification language for expressing.
Modern Programming Tools And Techniques-I
Crosscutting Capabilities for Java and AspectJ through DJ
Aspect-Oriented Programming with the Eclipse AspectJ plug-in
Discussion with Gregor Kiczales at UBC
For John.
Demeter Aspects Who We Are Aspectual Collaborations
ADAPTIVE PROGRAMMING Sezen ERDEM December 2005.
Better Separation of Crosscutting Concerns with Aspectual Components
APPCs revisited 2/25/2019 APPCs revisited.
AOSD and the Law of Demeter: Shyness in Programming
Options for Demeter intergration into AspectJ
Presentation transcript:

Master’s Thesis Defense: Aspectual Concepts John J. Sung

EMETER Outline Motivation JPM and Demeter Concepts Demeter integrated with AspectJ ( AJ) AJ Semantics/Syntax AJ System Architecture Conclusion

EMETER Motivation Aspect Oriented Software Development Gaining Momentum –1 st International Conference on AOSD –AspectJ, DemeterJ, ConcernJ, HyperJ, etc. AOSD is Relatively Young –Demeter C++ ~1989 –DemeterJ ~ 1996 –AspectJ ~1997

EMETER Questions What are the fundamental concepts behind AOSD? How are these concepts related? How can these concepts be combined? What are the fundamental problems that software language features attempt to solve?

EMETER Join Point Model (JPM) Fundamental Concepts –Join Point, Pointcut, Advice, Aspect, Introduction –Concepts applied to call graph in AspectJ –Introduction also applied to class graph –Construction Metaphor

EMETER Construction Metaphor Concepts in JPM create an image of structures constructed from building blocks

EMETER AspectJ Abstraction of Programs Call GraphPointcuts ++ Advices => Program

EMETER AspectJ Abstraction of Programs foo(){ x = 0; if (x < 0) throw KException; } Class Bar int x; b1.foo(); Class C1 within(Bar) Aspect A before() : within(Bar) { }

EMETER Another View Java Program AspectJ Advice pointcut advice body join point

EMETER Demeter Fundamental Concepts –Class Graph, Strategy, Visitor, Advice –Concepts applied to data structures, i.e. class graph –Journey Metaphor

EMETER Journey Metaphor Concepts in Demeter create an image of a person on a journey

EMETER Demeter Abstraction of Programs Class Graph Strategy Graph ++ Visitor Advices => Program

EMETER Demeter Abstraction of Programs => before(..) after(..) before(..) Class Graph Strategy Graph Traversal Graph Visitor Advices

EMETER Combining Concepts Application of JPM to Demeter –Class graph is built of classes and edges –Join points become the points along traversals –Advices are executed at these join points

EMETER Combining Concepts Application of Demeter to JPM –CPU executes the traversal through the dynamic call graph –CPU manages the dynamic call graph –Advices are for the one visitor: CPU

EMETER Demeter AspectJ: AJ Extends AspectJ with traversal capability Defines a traversal specification language Uses DJ to generate Class Graph, Traversal Graph Generates the AspectJ implementation of the traversal using AspectJ introductions Implemented using DemeterJ, DJ, AspectJ Blending of JPM and Demeter Concepts

EMETER Design of AJ First Design –Add syntax to AspectJ language –Modify the open source ajc –Use DJ and AspectJ to modify the behavior Second Design –Use ajc as the back end –Create a small language to describe traversals –Use DJ, AspectJ, DemeterJ –Less coupling with the AspectJ compiler

EMETER Traversal Specification Language Designed to have similar syntax to DJ and AspectJ Allows users to specify Class Graph, Traversal, and Visitor Generates AspectJ implementation of traversals using introductions Visitor advices are called by using AspectJ advices

EMETER Class Graph Specification Default Class Graph –ClassGraph cgvar; Class Graph Slice –ClassGraph cgvar = new ClassGraph(cg, “strategy”);

EMETER Visitor Specification Uses Java Reflection to obtain method signatures Recognized Methods –around, before, after, start, finish, returnValue Visitor Declaration –Visitor visitorClass;

EMETER Traversal Specification Default Traversal Specification –declare traversal tvar : “strategy”; Traversal with Class Graph –declare traversal tvar(cgvar) : “strategy”; Traversal with Visitor –declare traversal tvar(cgvar, visitorvar) : “strategy”;

EMETER Aspect Specification aspect aspectName { class graph declarations; traversal declarations; visitor declarations; }

EMETER What AJ Generates For each default and class graph slice traversal –method void tvar() for the source node of the traversal strategy For each traversal with visitor –method void tvar() for the source node of the traversal strategy –method void tvar(visitorClass) for the source node of the traversal strategy –Appropriate AspectJ advices for each advice method in visitorClass

EMETER A Simple Basket Example class Basket { Basket(Fruit _f, Pencil _p) { f = _f; p = _p; } Basket(Fruit _f, Fruit _f2, Pencil _p) { f = _f; f2 = _f2; p = _p; } Fruit f, f2; Pencil p; } class Fruit { Fruit(Weight _w) { w = _w; } Weight w; } class Orange extends Fruit { Orange(Color _c) { super(null); c=_c;} Orange(Color _c, Weight _w) { super(_w); c = _c;} Color c; } class Pencil {} class Color { Color(String _s) { s = _s;} String s; } class Weight{ Weight(int _i) { i = _i;} int i; int get_i() { return i; } }

EMETER A Simple Basket Example Basket FruitPencil p f, f2 Orange Weight Color wc String s int i

EMETER BasketVisitor class BasketVisitor { int total; public void start() { total = 0; } public int returnValue() { return total; } void before(Weight w) { total += w.get_i(); }

EMETER Basket Traversal aspect BasketTraversal { ClassGraph default; ClassGraph myClassGraph = new ClassGraph(default, "from Basket to *"); Visitor BasketVisitor; declare traversal t1(myClassGraph,BasketVisitor) : "from Basket to Weight"; declare traversal t2(myClassGraph,BasketVisitor) : "from Basket via Orange to Weight"; }

EMETER Basket Main class BasketMain { static public void main(String args[]) throws Exception { Basket b = new Basket(new Orange(new Color("orange"), new Weight(5)), new Fruit( new Weight(10)), new Pencil() ); BasketVisitor bv = new BasketVisitor(); b.t1(bv); int totalWeight = bv.returnValue(); System.out.println("Total weight of basket = " + totalWeight); b.t2(bv); totalWeight = bv.returnValue(); System.out.println("Total weight2 of basket = " + totalWeight); }

EMETER Generated Code for Visitor static BasketVisitor t1_visitor; public void Basket.t1(BasketVisitor v) { t1_visitor=v; t1_visitor.start(); t1(); } before(Weight host) : call(public void t1*()) && target(host) { t1_visitor.before(host); } void Basket.t1() { t1_copy0(); }

EMETER Basket Class Graph Basket FruitPencil p f, f2 Orange Weight Color wc String s int i

EMETER Generated Code for Traversal // traversal t1 : {source: Basket -> target: Weight} with { } public void Basket.t1_copy0(){ if (f != null) t1_copy0_crossing_f(); if (f2 != null) t1_copy0_crossing_f2(); } public void Basket.t1_copy0_crossing_f() { f.t1_copy0();} public void Basket.t1_copy0_crossing_f2() { f2.t1_copy0();} public void Fruit.t1_copy0(){ if (w != null) t1_copy0_crossing_w(); } public void Fruit.t1_copy0_crossing_w() { w.t1_copy0();} public void Weight.t1_copy0(){ } public void Orange.t1_copy0(){ super.t1_copy0(); } pointcut pointcut_t1() : call(public void t1*()); before () : pointcut_t1 () { System.out.println(thisJoinPoint); }

EMETER System Architecture DAJ Main –Parses command line arguments –Manages the DAJ code generation phases Stub Generation –Generates stubs for traversal methods Traversal Generation Compilation –Compiles using ajc the stubs, user code, and CreateClassGraph.java

EMETER System Architecture Traversal Generation –Uses DJ, Java Reflection, and DemeterJ to generate AspectJ traversal code Traversal Compilation –Compiles the generated traversal code with user code

EMETER System Architecture Stub Generation Traversal Generation Compilation Traversal Generation Traversal Compilation DAJ Main method call shell

EMETER AJ Process Stub Generation Traversal Files Generated Stubs Traversal Generation Compilation Class Files Traversal Generation Traversal Compilation User Code CreateClassGraph.java Traversal Implementation User Code to DAJ Code Provided by DAJ Intermediate Files Final Application

EMETER Traversal Generation CreateClassGraph.java –intercepts the call to main –instantiates a ClassGraph using DJ Arguments and ClassGraph Uses DJ to generate Traversal Graph Translates the Traversal Graph to AspectJ introductions Visitor code generation –uses Java Reflection to obtain method signitures –generates AspectJ advices for each visitor advice

EMETER Example Run of AJ [denali: ~/demeter/daj/dev/basket2] > java edu.neu.ccs.demeter.daj.DAJ -main BasketMain -dtrv trav -ccg../ccg/CreateClassGraph.java BasketMain.java BasketTraversal.trv BasketVisitor.java %I - Generating Stubs prefix for stub: trav Generating Stub file: trav/BasketTraversal.java %I - traversal generation compilation ajc../ccg/CreateClassGraph.java BasketMain.java BasketVisitor.java trav/BasketTraversal.java %I - traversal generation java BasketMain -d trav BasketTraversal.trv %I - traversal compilation ajc BasketMain.java BasketVisitor.java trav/BasketTraversal.java

EMETER Measuring Performance Traversals implemented in DemeterJ, DJ, DAJ Vary the size of the Object Graph Measure the elapsed time between start and finish SunBlade 100 running SunOS 5.8

EMETER Performance Comparison

EMETER DemeterJ and AJ Performance

EMETER Performance Comparison

EMETER Future AJ Improvements Two syntax supported –DJ/Java like style –AspectJ’s declare syntax Handle Collections –Traversal through Java Collections Handle interfaces –Generates Traversals correctly for interfaces

EMETER Questions What are the fundamental concepts behind AOSD in Demeter and AspectJ? How are these concepts related? How can these concepts be combined? What are the fundamental problems that software language features attempt to solve?

EMETER Software Design Concerns Organizational Concern –How do I organize my code? Factorizational Concern –How can I factor similar code? Specification Concern –What can I specify within the program? Interface Concern –How can I interface with someone else’s code?

EMETER Conclusions Metaphors used in Demeter and JPM –Construction and Journey Metaphors –Usage of one or the other depends on the users and application –Can describe each other –Combinable

EMETER Conclusions DAJ –Mixing Demeter with AspectJ concepts –Uses DJ, DemeterJ and AspectJ –Extends AspectJ incrementally –Faster traversals than DJ –

EMETER Conclusions Software Design Concerns –Organizational, Factorizational, Specification, and Interface –How do programming features address SDC? –How do SDCs related to AOP? –Further research needed

EMETER Future Direction Analyze the metaphors used in other tools –ComposeJ, HyperJ, etc. Try combining these concepts Use the Software Design Concerns to analyze AOP tools

EMETER AspectJ from PARC AJ J EMETERJ (Demeter AspectJ)

EMETER References Javawww.ccs.neu.edu/research/demeter/Demeter Java

EMETER Static Scattering and Tangling aspect i is scattered across many classes (i = 1,2,3) class X tangles aspects 1, 2 and 3 aspect1aspect2aspect3 class A consisting of three aspects classes for aspect1 classes for aspect2 classes for aspect3 Class X class diagram Adding to classes

EMETER Dynamic Scattering and Tangling program execution involving three aspects (colors r b g) program call tree (objects executing method calls) Each aspect (colors) is scattered across many classes (shapes) Class tangles all three aspects At those calls the aspect enhances the behavior classes this(s) target(t) f(..) Enhancing calls t.f(..);

EMETER subcomputation = join points related to traversing through the objects guided by traversal specification and class graph.

EMETER Pointcut –set of execution points of any method, … –rich set of primitive pointcuts: this, target, call, … + set operations –where to enhance Advice –how to enhance Visitor method sig. –set of execution points of traversals –specialized for traversals (nodes, edges) –where to enhance Visitor method bodies –how to enhance DJAspectJ From DJ to AspectJ