1 / 32

Fluid AJ - A Simple Fluid AOP Tool

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.

rianne
Download Presentation

Fluid AJ - A Simple Fluid AOP Tool

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Fluid AJ - A Simple Fluid AOP Tool Terry Hon Gregor Kiczales 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 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 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 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 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 CAS Seminar 06

  7. Fluid AJ • Eclipse plugin • Implements the principles of Fluid AOP • Modularizes interaction with crosscutting code • Edit time weaving 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 CAS Seminar 06

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

  10. Display Updating cont’d • Use the following pointcut to describe join points pointcut change: execution(public void figures.Shape+.set*(*)) • Display updating calls need to be added at the end of these join points 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 { } CAS Seminar 06

  12. CAS Seminar 06

  13. CAS Seminar 06

  14. CAS Seminar 06

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

  16. Editing the advice body here Keeps all these code blocks in synch – a crosscutting slice. 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; } CAS Seminar 06

  18. CAS Seminar 06

  19. 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 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 } CAS Seminar 06

  22. CAS Seminar 06

  23. CAS Seminar 06

  24. 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 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 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? 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 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 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 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 CAS Seminar 06

  32. Questions? Fluid AOP – Fluid AJ Editor Terry Hontyehon@cs.ubc.ca CAS Seminar 06

More Related