fluid aj - a simple fluid aop tool
DESCRIPTION
Fluid AJ - A Simple Fluid AOP Tool. Terry Hon Gregor Kiczales. General AOP Terminology. Crosscutting concerns Concerns that do not correspond to the core decomposition of the system Join point model Join points Means of identifying join points Means of affecting join points Weaving. - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: Fluid AJ - A Simple Fluid AOP Tool](https://reader035.vdocuments.net/reader035/viewer/2022062500/56815097550346895dbe94a3/html5/thumbnails/1.jpg)
University of British Columbia
Software Practices Lab
CAS Seminar 06
Fluid AJ - A Simple Fluid AOP
Tool
Terry HonGregor Kiczales
![Page 2: Fluid AJ - A Simple Fluid AOP Tool](https://reader035.vdocuments.net/reader035/viewer/2022062500/56815097550346895dbe94a3/html5/thumbnails/2.jpg)
CAS Seminar 06 2
General AOP Terminology
• Crosscutting concerns– Concerns that do not correspond to the core
decomposition of the system
• Join point model– Join points– Means of identifying join points– Means of affecting join points
• Weaving
![Page 3: Fluid AJ - A Simple Fluid AOP Tool](https://reader035.vdocuments.net/reader035/viewer/2022062500/56815097550346895dbe94a3/html5/thumbnails/3.jpg)
CAS Seminar 06 3
Crosscutting Concerns• Code becomes scattered and tangled
• Scattered code– Spread around the system
• Tangled code– Mixed with other concerns
• Hard to maintain and manage as system evolve
![Page 4: Fluid AJ - A Simple Fluid AOP Tool](https://reader035.vdocuments.net/reader035/viewer/2022062500/56815097550346895dbe94a3/html5/thumbnails/4.jpg)
CAS Seminar 06 4
Linguistic AOP Approach
• Crosscutting concerns are captured in aspects
• Aspects are new constructs in the programming language
• Weaving is done at compile or post-compile time
![Page 5: Fluid AJ - A Simple Fluid AOP Tool](https://reader035.vdocuments.net/reader035/viewer/2022062500/56815097550346895dbe94a3/html5/thumbnails/5.jpg)
CAS Seminar 06 5
Problem Statement
• Linguistic AOP approach has disadvantages– Requires new language adoption– Compile time weaving means developers cannot
reason about woven code
• Fluid AOP provides another option for programming in AOP
![Page 6: Fluid AJ - A Simple Fluid AOP Tool](https://reader035.vdocuments.net/reader035/viewer/2022062500/56815097550346895dbe94a3/html5/thumbnails/6.jpg)
CAS Seminar 06 6
Fluid AOP
• Supports modularization of crosscutting concerns in IDE
• Provides temporary view that modularizes current concern
• These views (aspects) can be generated each time it is needed, or can be stored as a meta object
![Page 7: Fluid AJ - A Simple Fluid AOP Tool](https://reader035.vdocuments.net/reader035/viewer/2022062500/56815097550346895dbe94a3/html5/thumbnails/7.jpg)
CAS Seminar 06 7
Fluid AJ
• Eclipse plugin
• Implements the principles of Fluid AOP
• Modularizes interaction with crosscutting code
• Edit time weaving
![Page 8: Fluid AJ - A Simple Fluid AOP Tool](https://reader035.vdocuments.net/reader035/viewer/2022062500/56815097550346895dbe94a3/html5/thumbnails/8.jpg)
CAS Seminar 06 8
JPM for Fluid AJ
• Join points– Code fragments in java files
• Method• Field• Constructor
• Means of identifying join points– Pointcuts: method, field or constructor
signatures, type patterns
• Means of affecting join points– Editing of text
![Page 9: Fluid AJ - A Simple Fluid AOP Tool](https://reader035.vdocuments.net/reader035/viewer/2022062500/56815097550346895dbe94a3/html5/thumbnails/9.jpg)
CAS Seminar 06 9
Display Updating• Consider a simple
drawing application (JHotDraw)
• Want to implement display updating (observer pattern)
![Page 10: Fluid AJ - A Simple Fluid AOP Tool](https://reader035.vdocuments.net/reader035/viewer/2022062500/56815097550346895dbe94a3/html5/thumbnails/10.jpg)
CAS Seminar 06 10
- Use the following pointcut to describe join points
Display Updating cont’d
- Display updating calls need to be added at the end of these join points
pointcut change: execution(public void figures.Shape+.set*(*))
![Page 11: Fluid AJ - A Simple Fluid AOP Tool](https://reader035.vdocuments.net/reader035/viewer/2022062500/56815097550346895dbe94a3/html5/thumbnails/11.jpg)
CAS Seminar 06 11
Display Updating Aspect
• So now we have an aspect that looks like the following (very similar syntax to AspectJ)
public aspect DisplayUpdating
pointcut change: execution(public void figures.Shape+.set*(*))
after returning: change { }
![Page 12: Fluid AJ - A Simple Fluid AOP Tool](https://reader035.vdocuments.net/reader035/viewer/2022062500/56815097550346895dbe94a3/html5/thumbnails/12.jpg)
CAS Seminar 06 12
![Page 13: Fluid AJ - A Simple Fluid AOP Tool](https://reader035.vdocuments.net/reader035/viewer/2022062500/56815097550346895dbe94a3/html5/thumbnails/13.jpg)
CAS Seminar 06 13
![Page 14: Fluid AJ - A Simple Fluid AOP Tool](https://reader035.vdocuments.net/reader035/viewer/2022062500/56815097550346895dbe94a3/html5/thumbnails/14.jpg)
CAS Seminar 06 14
![Page 15: Fluid AJ - A Simple Fluid AOP Tool](https://reader035.vdocuments.net/reader035/viewer/2022062500/56815097550346895dbe94a3/html5/thumbnails/15.jpg)
CAS Seminar 06 15
Matched join points are “prepared” by adding comments and advice block
![Page 16: Fluid AJ - A Simple Fluid AOP Tool](https://reader035.vdocuments.net/reader035/viewer/2022062500/56815097550346895dbe94a3/html5/thumbnails/16.jpg)
CAS Seminar 06 16
Editing the advice body here
Keeps all these code blocks in synch – a crosscutting slice.
![Page 17: Fluid AJ - A Simple Fluid AOP Tool](https://reader035.vdocuments.net/reader035/viewer/2022062500/56815097550346895dbe94a3/html5/thumbnails/17.jpg)
CAS Seminar 06 17
Intertype Declarations
• Want to add a Display field for each Shape class
• Instead of calling static update method, we will call the update on the Display object
• Add the following to the DisplayUpdating aspect
declare for figures.Shape{ private displays.Display display; }
![Page 18: Fluid AJ - A Simple Fluid AOP Tool](https://reader035.vdocuments.net/reader035/viewer/2022062500/56815097550346895dbe94a3/html5/thumbnails/18.jpg)
CAS Seminar 06 18
![Page 19: Fluid AJ - A Simple Fluid AOP Tool](https://reader035.vdocuments.net/reader035/viewer/2022062500/56815097550346895dbe94a3/html5/thumbnails/19.jpg)
CAS Seminar 06 19
![Page 20: Fluid AJ - A Simple Fluid AOP Tool](https://reader035.vdocuments.net/reader035/viewer/2022062500/56815097550346895dbe94a3/html5/thumbnails/20.jpg)
CAS Seminar 06 20
Different Fluid AJ view
• Editing of crosscutting concern is modularized
• Viewing of the concern is still scattered and tangled with other concerns
• Another way developer can interact with code is to gather all the join points of a concern into one view
![Page 21: Fluid AJ - A Simple Fluid AOP Tool](https://reader035.vdocuments.net/reader035/viewer/2022062500/56815097550346895dbe94a3/html5/thumbnails/21.jpg)
CAS Seminar 06 21
Gather declaration
• Use the pointcut change defined in the previous aspect
• Instead of using the pointcut in an advice, we can use it in a gather declaration
public aspect GatherDisplayUpdating {
pointcut change: execution(public void figures.Shape+.set*(*))
gather : change
}
![Page 22: Fluid AJ - A Simple Fluid AOP Tool](https://reader035.vdocuments.net/reader035/viewer/2022062500/56815097550346895dbe94a3/html5/thumbnails/22.jpg)
CAS Seminar 06 22
![Page 23: Fluid AJ - A Simple Fluid AOP Tool](https://reader035.vdocuments.net/reader035/viewer/2022062500/56815097550346895dbe94a3/html5/thumbnails/23.jpg)
CAS Seminar 06 23
![Page 24: Fluid AJ - A Simple Fluid AOP Tool](https://reader035.vdocuments.net/reader035/viewer/2022062500/56815097550346895dbe94a3/html5/thumbnails/24.jpg)
CAS Seminar 06 24
![Page 25: Fluid AJ - A Simple Fluid AOP Tool](https://reader035.vdocuments.net/reader035/viewer/2022062500/56815097550346895dbe94a3/html5/thumbnails/25.jpg)
CAS Seminar 06 25
Fluid AJ vs. AspectJ (Linguistic AOP)• Different join point model
– Dynamic vs. static
• Different adoption profile– Plain old Java tools can be used on all but
aspect (.fa) files– Aspect files are only meta files– Edit time weaving– Woven files are in normal java code
![Page 26: Fluid AJ - A Simple Fluid AOP Tool](https://reader035.vdocuments.net/reader035/viewer/2022062500/56815097550346895dbe94a3/html5/thumbnails/26.jpg)
CAS Seminar 06 26
Status
• Implemented a simple prototype as an Eclipse plugin– 3 kinds of advice: before, after and after
returning– Execution pointcut– Intertype declarations– Very basic gather declarations
![Page 27: Fluid AJ - A Simple Fluid AOP Tool](https://reader035.vdocuments.net/reader035/viewer/2022062500/56815097550346895dbe94a3/html5/thumbnails/27.jpg)
CAS Seminar 06 27
Open Questions
• What happens when a developer changes an advice body outside of the aspect file?
• What happens if an advice body is deleted?
• What is the best way to show a concern (modularizing both viewing and editing of concern)?
• Possible intermediate step in AOP adoption or AOP solution qua itself?
![Page 28: Fluid AJ - A Simple Fluid AOP Tool](https://reader035.vdocuments.net/reader035/viewer/2022062500/56815097550346895dbe94a3/html5/thumbnails/28.jpg)
CAS Seminar 06 28
Another Design Space
• Advice declarations gave us modularization for editing of concerns
• Gather declarations gave us modularization for viewing of concerns
• The next step would be to provide a view that can both modularize the editing and also the viewing of crosscutting concerns
![Page 29: Fluid AJ - A Simple Fluid AOP Tool](https://reader035.vdocuments.net/reader035/viewer/2022062500/56815097550346895dbe94a3/html5/thumbnails/29.jpg)
CAS Seminar 06 29
Overlay• Gathers all join points
in the concern and present an abstraction of them
• When you edit the abstraction, the join points also change
• Provides modularization for editing and viewing of concern
![Page 30: Fluid AJ - A Simple Fluid AOP Tool](https://reader035.vdocuments.net/reader035/viewer/2022062500/56815097550346895dbe94a3/html5/thumbnails/30.jpg)
CAS Seminar 06 30
Related Work
• [Toonim et. al., 04]– Linked Editing– Persistent linking of crosscutting code snippets– No semantic approach for describing
crosscutting concerns– User has to manually select each join point
• [Miller et. al., 01]– Simultaneous Text Editing– Provides simple language for describing
crosscutting concerns– Non-persistent linking
![Page 31: Fluid AJ - A Simple Fluid AOP Tool](https://reader035.vdocuments.net/reader035/viewer/2022062500/56815097550346895dbe94a3/html5/thumbnails/31.jpg)
CAS Seminar 06 31
Related Work cont’d
• [Harrison et. al., 02]– Concern Manipulation Environment (CME)– Post-compile time weaving– No mechanisms for reasoning about woven code
![Page 32: Fluid AJ - A Simple Fluid AOP Tool](https://reader035.vdocuments.net/reader035/viewer/2022062500/56815097550346895dbe94a3/html5/thumbnails/32.jpg)
University of British Columbia
Software Practices Lab
CAS Seminar 06
Questions?
Fluid AOP – Fluid AJ Editor
Terry [email protected]