Presentation is loading. Please wait.

Presentation is loading. Please wait.

University of British Columbia Software Practices Lab CAS Seminar 06 Fluid AJ - A Simple Fluid AOP Tool Terry Hon Gregor Kiczales.

Similar presentations


Presentation on theme: "University of British Columbia Software Practices Lab CAS Seminar 06 Fluid AJ - A Simple Fluid AOP Tool Terry Hon Gregor Kiczales."— Presentation transcript:

1 University of British Columbia Software Practices Lab CAS Seminar 06 Fluid AJ - A Simple Fluid AOP Tool Terry Hon Gregor Kiczales

2 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

3 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

4 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

5 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

6 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

7 CAS Seminar 06 7 Fluid AJ Eclipse plugin Implements the principles of Fluid AOP Modularizes interaction with crosscutting code Edit time weaving

8 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

9 CAS Seminar 06 9 Display Updating Consider a simple drawing application (JHotDraw) Want to implement display updating (observer pattern)

10 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*(*))

11 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 { }

12 CAS Seminar 06 12

13 CAS Seminar 06 13

14 CAS Seminar 06 14

15 CAS Seminar 06 15 Matched join points are “prepared” by adding comments and advice block

16 CAS Seminar 06 16 Editing the advice body here Keeps all these code blocks in synch – a crosscutting slice.

17 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; }

18 CAS Seminar 06 18

19 CAS Seminar 06 19

20 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

21 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 }

22 CAS Seminar 06 22

23 CAS Seminar 06 23

24 CAS Seminar 06 24

25 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

26 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

27 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?

28 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

29 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

30 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

31 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

32 University of British Columbia Software Practices Lab CAS Seminar 06 Questions? Fluid AOP – Fluid AJ Editor Terry Hon tyehon@cs.ubc.ca


Download ppt "University of British Columbia Software Practices Lab CAS Seminar 06 Fluid AJ - A Simple Fluid AOP Tool Terry Hon Gregor Kiczales."

Similar presentations


Ads by Google