1 / 8

Aspect-Oriented Programming: An Overview Brandon Wirick Feb. 2005

Aspect-Oriented Programming: An Overview Brandon Wirick Feb. 2005. Layers of Abstraction. Machine code to assembly Assembly to procedural languages Procedural to object-oriented Group similar compile-time functional units Object- to aspect-oriented Group similar run-time functional units.

moswen
Download Presentation

Aspect-Oriented Programming: An Overview Brandon Wirick Feb. 2005

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. Aspect-Oriented Programming: An Overview Brandon Wirick Feb. 2005

  2. Layers of Abstraction • Machine code to assembly • Assembly to procedural languages • Procedural to object-oriented • Group similar compile-time functional units • Object- to aspect-oriented • Group similar run-time functional units

  3. Join-point Poincut Weaving compile-time run-time Loop fusion Tangling Terminology • AOP • AOSD • Concerns • common • crosscutting • Aspect • AspectJ

  4. AspectJ • Java with aspects • Aspects are singleton classes • Group join-points into pointcuts • Define behavior before, after, or around pointcuts • Specify contract enforcements • Can contain members, like classes • Definitely most prominent language

  5. AspectJ Example public aspect NoNulls { public static interface Addable { public boolean add(Object o); } pointcut add(Object o) : call(boolean Addable.add(Object)) && args(o); boolean around(Object o) : add(o){ boolean success = (o != null); success &= proceed(o); return success; } } class NoNullsVector extends Vector implements NoNulls.Addable {} class NoNullsArrayList extends ArrayList implements NoNulls.Addable {}

  6. Kiczales et al, 1997 • Noted certain problems could have implementations that are either • Efficient, but hard to understand • Inefficient, but easy to understand • Efficient and easy to understand, but only with AOP! • “Reduction in bloat due to tangling”

  7. Design Pattern Libraries public abstract aspect ObserverProtocol { protected interface Subject {} protected interface Observer {} ... protected abstract pointcut subjectChange(Subject s); ... public aspect ColorObserver extends ObserverProtocol{ declare parents: Point implements Subject; declare parents: Screen implements Observer; ...

  8. Not for Dumb Programmers • Easy to do wrong • Complicated to understand • Controversial • Not so much anymore • Arguments against AOP pretty weak • Some unpredictable behavior?

More Related