Presentation is loading. Please wait.

Presentation is loading. Please wait.

Java.sun.com/javaone/sf | 2004 JavaOne SM Conference | Session BUS-3192 1 JavaOne 2004 What is AOP? Gregor Kiczales AspectMentor.com and University of.

Similar presentations


Presentation on theme: "Java.sun.com/javaone/sf | 2004 JavaOne SM Conference | Session BUS-3192 1 JavaOne 2004 What is AOP? Gregor Kiczales AspectMentor.com and University of."— Presentation transcript:

1 java.sun.com/javaone/sf | 2004 JavaOne SM Conference | Session BUS-3192 1 JavaOne 2004 What is AOP? Gregor Kiczales AspectMentor.com and University of British Columbia Once More Around the Wheel

2 | 2004 JavaOne SM Conference | Session BUS-3192 2 19641974200419841994 Consider developing… a simple drawing application (JHotDraw)

3 | 2004 JavaOne SM Conference | Session BUS-3192 3 19641974200419841994 Intuitively thinking of objects? ─Points, Lines… ─Drawing surfaces ─GUI Widgets ─… objects are intuitive Display 2 Point getX() getY() setX(int) setY(int) moveBy(int, int) Line getP1() getP2() setP1(Point) setP2(Point) moveBy(int, int) Shape moveBy(int, int) *

4 | 2004 JavaOne SM Conference | Session BUS-3192 4 19641974200419841994 In 1969 most programmers would have used this has poor design and code modularity! 2212 6593 4329 8665 24 collection of procedures to operate on and manage table entries 6758 + objects are not intuitive objects are intuitive

5 | 2004 JavaOne SM Conference | Session BUS-3192 5 19641974200419841994 OOP invented in 1961 –about same time as structured programming –term “object-oriented programming” in 1967 –to make simulation code look like the model OOP intuitive not intuitive

6 | 2004 JavaOne SM Conference | Session BUS-3192 6 19641974200419841994 What is OOP? a “way of thinking” ─objects, classification hierarchies supporting mechanisms ─classes, encapsulation, polymorphism… allows us to ─make code look like the design ─improves design and code modularity many possible implementations ─style, library, ad-hoc PL extension, integrated in PL many other benefits build on these OOP intuitive

7 | 2004 JavaOne SM Conference | Session BUS-3192 7 19641974200419841994 class Point extends Shape { private int x = 0, y = 0; int getX() { return x; } int getY() { return y; } void setX(int x) { this.x = x; display.update(this); } void setY(int y) { this.y = y; display.update(this); } MVCObserver Pattern fair design modularity but poor code modularity 1 Display 2 Point getX() getY() setX(int) setY(int) moveBy(int, int) Line getP1() getP2() setP1(Point) setP2(Point) moveBy(int, int) Shape moveBy(int, int) * OOP

8 | 2004 JavaOne SM Conference | Session BUS-3192 8 19641974200419841994 Meanwhile back at the ranch… starting in early 80’s (perhaps earlier) others began work on ─crosscutting structure ─mechanisms ─behavioral reflection, metaobject protocols, subject-oriented programming… “aspect-oriented programming” term in 1997 MVCObserver Pattern AOP OOP

9 | 2004 JavaOne SM Conference | Session BUS-3192 9 19641974200419841994 aspect ObserverPattern { private Display Shape.display; pointcut change(): call(void figures.Point.setX(int)) || call(void Point.setY(int)) || call(void Line.setP1(Point)) || call(void Line.setP2(Point)) || call(void Shape.moveBy(int, int)); after(Shape s) returning: change() && target(s) { s.display.refresh(); } } ObserverPattern 1 Display 2 Point getX() getY() setX(int) setY(int) moveBy(int, int) Line getP1() getP2() setP1(Point) setP2(Point) moveBy(int, int) Shape moveBy(int, int) * OOP AOP

10 | 2004 JavaOne SM Conference | Session BUS-3192 10 19641974200419841994 aspect ObserverPattern { private Display Shape.display; pointcut change(): call(void Shape.moveBy(int, int)) || call(void Shape+.set*(..)); after(Shape s) returning: change() && target(s) { s.display.refresh(); } } ObserverPattern 1 Display 2 Point getX() getY() setX(int) setY(int) moveBy(int, int) Line getP1() getP2() setP1(Point) setP2(Point) moveBy(int, int) Shape moveBy(int, int) * well-defined crosscutting structure OOP AOP

11 | 2004 JavaOne SM Conference | Session BUS-3192 11 19641974200419841994 aspect ObserverPattern { private Display Shape.display; pointcut change(): call(void Shape.moveBy(int, int)) || call(void Shape+.set*(..)); after(Shape s) returning: change() && target(s) { s.display.refresh(); } } ObserverPattern 1 Display 2 Point getX() getY() setX(int) setY(int) moveBy(int, int) Line getP1() getP2() setP1(Point) setP2(Point) moveBy(int, int) Shape moveBy(int, int) * Ask yourself: could you name a single class “ObserverPattern” ? well-defined crosscutting structure OOP AOP

12 | 2004 JavaOne SM Conference | Session BUS-3192 12 19641974200419841994 What is AOP? “a way of thinking” ─aspects, crosscutting structure supporting mechanisms ─join points, pointcuts, advice… allows us to ─make code look like the design ─improve design and code modularity many possible implementations ─style, library, ad-hoc PL extension, integrated in PL OOP AOP

13 | 2004 JavaOne SM Conference | Session BUS-3192 13 19641974200419841994 Other Aspects ─design patterns [Google: AOP design pattern] ─Swing thread safety [AspectJ in Action] ─policy enforcement ─authentication, synchronization, architecture ─transaction management ─debugging support ─logging (of course) ─and many application-specific aspects OOP AOP

14 | 2004 JavaOne SM Conference | Session BUS-3192 14 19641974200419841994 IBM reports ─implementation of platform policies ─15-30% quality improvements ─significant productivity gains ─improvements in modularity of complex software ─new business opportunities OOP AOP

15 | 2004 JavaOne SM Conference | Session BUS-3192 15 19641974200419841994 Issues good vs. bad uses ─can overuse/misuse any mechanism ─we have learned a lot, we need to learn more over hype, bad pedagogy ─each new wave of adoption brings new zealots / critics ─some old lessons need to be rediscovered tools ─quality, support… training, organization structure… what’s the business value?

16 | 2004 JavaOne SM Conference | Session BUS-3192 16 19641974200419841994 Issue: Proper Style mechanisms can be misused ─too many or wrong procedures ─too many or wrong classes ─too much or wrong overriding ─too many or wrong aspects, advice, introductions we already know a lot ─15% rule, well-defined crosscutting, tool support we have a lot to learn ─interaction w/ JSR-175; more “semantic pointcuts” ─scaling OOP AOP

17 | 2004 JavaOne SM Conference | Session BUS-3192 17 19641974200419841994 Issue: Implementation Quality implementations vary > 10x in performance! range of existing strategies VM-based implementation just now starting limited existing benchmarks but this is getting better fast OOP AOP

18 | 2004 JavaOne SM Conference | Session BUS-3192 18 19641974200419841994 Issue: Over-stated claims, bad pedagogy each wave of interest / adoption ─new proponents and critics ─have different priorities ─but must re-learn old lessons new generations of proponents ─can be too optimistic new generations of teachers ─can miss critical insights new generation of critics ─can miss previously discussed issues OOP AOP

19 | 2004 JavaOne SM Conference | Session BUS-3192 19 19641974200419841994 Question for panel: How can Java Platform remain #1 for AOP? ─what are the next steps? ─how does “really new” technology get in? ─what are the technical issues? ─how can AOP get proven enough ─what are market issues? ─is AOP disruptive technology for J2EE? ─where does it produce significant value? ─what will Redmond do? OOP AOP


Download ppt "Java.sun.com/javaone/sf | 2004 JavaOne SM Conference | Session BUS-3192 1 JavaOne 2004 What is AOP? Gregor Kiczales AspectMentor.com and University of."

Similar presentations


Ads by Google