Integration of Demeter and AspectJ (DAJ) John J. Sung.

Slides:



Advertisements
Similar presentations
Continuation of chapter 6…. Nested while loop A while loop used within another while loop is called nested while loop. Q. An illustration to generate.
Advertisements

AspectWerkz 2 - and the road to AspectJ 5 Jonas Bonér Senior Software Engineer BEA Systems.
INTERFACES IN JAVA 1.Java Does not support Multiple Inheritance directly. Multiple inheritance can be achieved in java by the use of interfaces. 2.We need.
Explaining DJ with AOP. DJ ClassGraph.traverse (this,whereToGo,whatToDo) Intertype declaration Advice.
Interfaces. Lecture Objectives To learn about interfaces To be able to convert between class and interface references To appreciate how interfaces can.
Aspect-Oriented Software Development (AOSD) Tutorial #3 AspectJ - continued.
Unit 2: Java Introduction to Programming 2.1 Initial Example.
XFindBugs: eXtended FindBugs for AspectJ Haihao Shen, Sai Zhang, Jianjun Zhao, Jianhong Fang, Shiyuan Yao Software Theory and Practice Group (STAP) Shanghai.
Java and C++, The Difference An introduction Unit - 00.
The NetBeans IDE CSIS 3701: Advanced Object Oriented Programming.
Introduction to Aspect Oriented Programming Presented By: Kotaiah Choudary. Ravipati M.Tech IInd Year. School of Info. Tech.
Master’s Thesis Defense: Aspectual Concepts John J. Sung.
Extensible Plug-ins for Aspect-Oriented Programming Macneil Shonle*Ankit Shah.
Graph Visualization Plug-in for Eclipse Gong Jun CCIS Northeastern Univ 10/2003 How To Finish your Project within Four Weeks.
Expression evaluation E : S | C. S = int. C = Op E E. Op : A | M. A = “+”. M = “*”.
Jaeki Song ISQS6337 JAVA Lecture 03 Introduction to Java -The First Java Application-
Aspect Oriented Programming Sumathie Sundaresan CS590 :: Summer 2007 June 30, 2007.
C#.Net Development Version 1.0. Overview Nullable Datatype Description ? HasValue Lifted Conversions null coalescing operator ?? Partial Classes Copyright.
Slides for Gregor Kiczales Two versions –short version: Crosscutting capabilities for Java and AspectJ through DJ (4 viewgraphs only) –long version: Controlling.
Advanced Compiler Design An Introduction to the Javali Compiler Framework Zoltán Majó 1.
AOP-1 Aspect Oriented Programming. AOP-2 Aspects of AOP and Related Tools Limitation of OO Separation of Concerns Aspect Oriented programming AspectJ.
AspectWrapper CHALFOUN Pierre et BUIST Éric. Overview Introduction – what and why In a nutshell – main components Our approach – how we did it Demo –
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.
Topic 1 Object Oriented Programming. 1-2 Objectives To review the concepts and terminology of object-oriented programming To discuss some features of.
IDENTIFYING SEMANTIC DIFFERENCES IN ASPECTJ PROGRAMS Martin Görg and Jianjun Zhao Computer Science Department, Shanghai Jiao Tong University.
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.
Course Progress Lecture 1 –Java data binding: Basket example: UML class diagram -> class dictionary without tokens-> language design -> class dictionary.
Overview of Java CSCI 392 Day One. Running C code vs Java code C Source Code C Compiler Object File (machine code) Library Files Linker Executable File.
Translating Traversals to AspectJ. Outline Motivation Demeter Process for Traversals AspectJ Translation Process.
Adaptive Aspect-Oriented Programming in AspectJ Karl J. Lieberherr Northeastern University.
Comparison of Different AOP Approaches Presented by: Xiaojing Wang.
Creating Web Services Presented by Ashraf Memon Presented by Ashraf Memon.
A comparison of C-Sharp and Java Zunaid Jogee Supervisor: T. Stakemire.
3 Project Objectives Aspectual Collaborations (AC) for the Connection Aspect –Metric: Does the restructuring of the UAV code with AC reduce the tangling.
Enum,Structure and Nullable Types Ashima Wadhwa. Enumerations, Enumerations, or enums, are used to group named constants similar to how they are used.
COM1205 TraversalJ Project* Pengcheng Wu Feb.25,2003.
AOP with AspectJ Awais Rashid, Steffen Zschaler © Awais Rashid, Steffen Zschaler 2009.
Catie Welsh February 14,  Program 2 Due Tonight by 11:59pm  Program 3 Assigned 2.
Talk only to your friends that share the same concerns (Law of Demeter for Concerns) Midterm Review February 2004.
Netprog Java RMI1 Remote Method Invocation.
Object Oriented Programming Lecture 2: BallWorld.
Programming in Java Transitioning from Alice. Becomes not myFirstMethod but …. public static void main (String[] arg) { // code for testing classes goes.
Features of AOP languages AOP languages have the following main elements: –a join point model (JPM) wrt base PL –a specification language for expressing.
Textual Visualization Plug-in for Eclipse Gong Jun CCIS Northeastern Univ 02/2004.
Java Methods and Applications CSIS 3701: Advanced Object Oriented Programming.
OBJECT ORIENTED PROGRAMMING
Web Design & Development Lecture 9
Crosscutting Capabilities for Java and AspectJ through DJ
“Packages in Java”.
Interface.
Aspect-Oriented Programming with the Eclipse AspectJ plug-in
Discussion with Gregor Kiczales at UBC
CompSci 230 Software Construction
For John.
Computing Adjusted Quiz Total Score
An Introduction to Java – Part I, language basics
Third lecture Review Visitor pattern DemeterJ 12/25/2018 SD.
AP/DJ AP: a generic technology
Better Separation of Crosscutting Concerns with Aspectual Components
Third lecture Review Visitor pattern DemeterJ 2/17/2019 SD.
class PrintOnetoTen { public static void main(String args[]) {
Introduction to Java Brief history of Java Sample Java Program
Options for Demeter intergration into AspectJ
Developing Java Applications with NetBeans
Developing Java Applications with NetBeans
Methods/Functions.
Aspect Oriented Programming
Presentation transcript:

Integration of Demeter and AspectJ (DAJ) John J. Sung

Outline Purpose of DAJ Syntax of Traversals Basket Example Development Process Conclusion

Purpose of DAJ Integration of Demeter ideas with AspectJ –Add notion of class graphs, traversals, visitors Minimize coupling with AspectJ compiler –Create an extension to AspectJ –Preprocess the files to generate AspectJ code –Use ajc as the back end of the compilation process

Overall Compilation Process Traversal Files AspectJ Files DAJ Class Files

Traversal Files Files with.trv extension Contains Traversal Specifications Preprocessed to generate AspectJ code

Syntax of Traversals ClassGraph Specification –ClassGraph cgvar; –ClassGraph cgvar = new ClassGraph(cg, “strategy”); Traversal Specification –declare traversal tvar : “strategy”; –declare traversal tvar(cgvar) : “strategy”;

Traversal Aspects Traversal Aspect Specification –aspect aspectName { – class graph and/or traversal declarations –}

Traversal Syntax Example aspect MyTraversal { ClassGraph defaultCG; ClassGraph cg1 = new ClassGraph(defaultCG, “from CompoundFile to * bypassing ->*,tail,*”); declare traversal t1: “from CompoundFile to SimpleFile”; declare traversal t2(cg1): “from CompoundFile to *”; }

Basket Example Basket FruitPencil p f Orange Weight Color wc String s int i

BasketMain.java class Weight{ Weight(int _i) { i = _i;} int i; int get_i() { return i; } } class Pencil {} class Color { Color(String _s) { s = _s;} String s; } class Basket { Basket(Fruit _f, Pencil _p) { f = _f; p = _p; } Fruit f; 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; }

BasketMain.java class BasketMain { static public void main(String args[]) throws Exception { Basket b = new Basket( new Orange( new Color("orange"), new Weight(5), new Pencil()); int totalWeight = b.totalWeight(); System.out.println("Total weight of basket = " + totalWeight); }

Traversals Count the total weight within the basket Traversal Strategy: “From Basket to Weight” Visitor: Add up all the values within Weight

Basket Example Traversal Graph Basket Fruit Pencil p f Orange Weight Color wc String s int i

BasketTraversal.trv // traversals for basket aspect BasketTraversal { ClassGraph default; ClassGraph myClassGraph = new ClassGraph(default, "from Basket to * bypassing {->*,*,java.lang.String }"); declare traversal t2(myClassGraph) : "from Basket to Weight"; }

BasketTraversal.java public aspect BasketTraversal { // traversal t2 : {source: Basket -> target: Weight} with { } public void Basket.t2(){ if (f != null) t2_crossing_f(); } public void Basket.t2_crossing_f() { f.t2();} public void Fruit.t2(){ if (w != null) t2_crossing_w(); } public void Fruit.t2_crossing_w() { w.t2();} public void Weight.t2(){ } public void Orange.t2(){ super.t2(); } pointcut pointcut_t2() : call(public void t2*()); before () : pointcut_t2 () { System.out.println(thisJoinPoint); } } // BasketTraversal

BasketMainCount.java // the aspect for counting the total weight of the basket aspect BasketMainCount { static int returnVal; int Basket.totalWeight() { returnVal = 0; t2(); return returnVal; } pointcut t2WeightPC(Weight weight) : call(* *t2*()) && target(weight); before(Weight weight) : t2WeightPC(weight) { returnVal += weight.get_i(); }

Compilation Process Parse the.trv files and generate stubs Compile user.java, stubs and CreateClassGraph.java Run the user code with stubs to generate the traversal code using DJ Compile user.java with generated traversals

Compilation Process Detail Traversal Files AspectJ Files DAJ Stub Java Files AspectJ Compiler CreateClassGraph.java Class Files Traversal Implementation Java Files AspectJ Compiler Traversal Implementation and User Class Files JVM

Conclusion Integrated Demeter style traversals with AspectJ –It has syntax similar to DJ and AspectJ –Generates traversals Web address –to be added later