1 / 19

What is AOP?

What is AOP?. Once More Around the Wheel. Gregor Kiczales AspectMentor.com and University of British Columbia. Consider developing… a simple drawing application (JHotDraw). *. Shape. Display. moveBy(int, int). Point. Line. 2. getX() getY() setX(int) setY(int) moveBy(int, int).

renep
Download Presentation

What is AOP?

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. What is AOP? Once More Around the Wheel Gregor Kiczales AspectMentor.com and University of British Columbia

  2. Consider developing…a simple drawing application (JHotDraw)

  3. * Shape Display moveBy(int, int) Point Line 2 getX()getY()setX(int)setY(int)moveBy(int, int) getP1()getP2()setP1(Point)setP2(Point)moveBy(int, int) objects are intuitive Intuitively thinking of objects? • Points, Lines… • Drawing surfaces • GUI Widgets • …

  4. collection of procedures to operate on and manage table entries objects are intuitive objects are not intuitive In 1969 most programmers would have used this has poor design and code modularity! +

  5. OOP intuitive not intuitive OOP invented in 1961 • about same time as structured programming • term “object-oriented programming” in 1967 • to make simulation code look like the model

  6. OOP intuitive 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

  7. class Pointextends Shape { privateint 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); } } 1 * Shape Display moveBy(int, int) Point Line 2 getX()getY()setX(int)setY(int)moveBy(int, int) getP1()getP2()setP1(Point)setP2(Point)moveBy(int, int) OOP MVC Observer Pattern fair design modularitybut poor code modularity

  8. AOP OOP MVC Observer Pattern 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

  9. OOP AOP * Shape Display moveBy(int, int) Point Line 2 getX()getY()setX(int)setY(int)moveBy(int, int) getP1()getP2()setP1(Point)setP2(Point)moveBy(int, int) 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(); }} 1 ObserverPattern

  10. OOP AOP * Shape Display moveBy(int, int) Point Line 2 getX()getY()setX(int)setY(int)moveBy(int, int) getP1()getP2()setP1(Point)setP2(Point)moveBy(int, int) 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(); }} 1 ObserverPattern well-definedcrosscutting structure

  11. OOP AOP * Shape Display moveBy(int, int) Point Line 2 getX()getY()setX(int)setY(int)moveBy(int, int) getP1()getP2()setP1(Point)setP2(Point)moveBy(int, int) Ask yourself:could you name asingle class “ObserverPattern” ? 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(); }} 1 ObserverPattern well-definedcrosscutting structure

  12. OOP AOP 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

  13. OOP AOP 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

  14. OOP AOP • IBM reports • implementation of platform policies • 15-30% quality improvements • significant productivity gains • improvements in modularity of complex software • new business opportunities

  15. 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. OOP AOP 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

  17. OOP AOP 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

  18. OOP AOP 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

  19. OOP AOP 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?

More Related