AspectOriented Programming with AspectJ - PowerPoint PPT Presentation

1 / 15
About This Presentation
Title:

AspectOriented Programming with AspectJ

Description:

OOPSLA, October 26-27 2004, Vancouver. http://eclipse.org/aspectj. 2. ... colored lines show relevant lines of code. fits nicely into one package (3 classes) ... – PowerPoint PPT presentation

Number of Views:70
Avg rating:3.0/5.0
Slides: 16
Provided by: theaspect
Category:

less

Transcript and Presenter's Notes

Title: AspectOriented Programming with AspectJ


1
aspectj toolsnew and noteworthy
Mik Kersten University of British Columbia
Adrian Colyer IBM Hursley
OOPSLA, October 26-27 2004, Vancouver
2
good modularity
  • socket creation in Tomcat
  • colored lines show relevant lines of code
  • fits nicely into one package (3 classes)

3
pretty good modularity
  • class loading in Tomcat
  • colored lines show relevant lines of code
  • mostly in one package (9 classes)

4
not so good modularity
  • logging in Tomcat
  • scattered across the packages and classes
  • error handling, security, business rules,

5
the cost of tangled code
  • redundant code
  • same fragment of code in many places
  • difficult to reason about
  • non-explicit structure
  • the big picture of the tangling isnt clear
  • difficult to change
  • have to find all the code involved
  • and be sure to change it consistently

6
the aop idea
  • crosscutting is inherent in complex systems
  • crosscutting concerns
  • have a clear purpose
  • have a natural structure
  • so, lets capture the structure of crosscutting
    concerns explicitly...
  • in a modular way
  • with linguistic and tool support

7
The role of tool support
  • IDE tools make code easy to navigate
  • Reference structure embedded In the code
  • Declaration lookup
  • Structured search
  • But inheritance structure can be hard to extract
    by reading code alone
  • Especially in large systems
  • E.g. who overrides this method?

8
Join points
  • Key points in program execution
  • method constructor execution
  • method constructor call
  • field get set
  • exception handler execution
  • static dynamic initialization
  • Demo

Line
end1Point
end2Point
moveBy(int, int)
moveBy(int, int)
moveBy(int, int)
9
1.2 tools demo
  • Figures
  • Core language
  • Spacewar
  • Build configs
  • Monitorlib
  • Aspect libraries bytecode weaving
  • WSIF
  • Visualizer
  • AJDoc

demo
10
AspectJ 1.2 tools suite
  • IDE plugins
  • AJDT for Eclipse (up to 3.0)
  • JBuilder (up to X)
  • NetBeans (up to 3.4.2)
  • Emacs
  • Other tools
  • Command line incremental compiler
  • Bytecode weaver
  • AJDoc
  • Ant task
  • AspectJ Browser

11
Making do without AOP support
  • Youre already working with crosscutting
    structure
  • J2EEs XML descriptors, generative programming
  • Structured search and refactoring tools can help
  • But its not explicit

12
Exposing crosscutting structure
  • AspectJ express crosscutting directly
  • Direct semantics enable good tool support
  • Crosscutting structure is explicit
  • Editor, views, documentation,
  • Demo auxiliary aspects, views

13
AOP reduces system complexity
  • Aspects are a new language mechanism, so there is
    a learning curve
  • But with good tool support AOP programs are
    easier to understand than their OO counterparts

14
Whats next?
  • Java 5 support
  • Refactoring
  • Java refactorings will update aspects
  • AspectJ refactorings
  • Aspect-oriented refactorings will help with
    migration and evolution
  • Structure views
  • Everywhere you seeOO structure you see the
    correspondingAO structure

15
Other AOP tools
  • AspectJ language compilers
  • ajc production, IDE integration
  • abc research, optimization
  • XML language compilers
  • AspectWerkz
  • JBoss AOP
  • Spring
  • Joint point models, pointcuts, and advice are the
    common to each of these

16
AspectJ credits
  • Versions 0.1-1.1 developed at PARC
  • Eclipse.org Technology project
  • AspectJ team
  • Andy Clement, Adrian Colyer, Erik Hilsdale, Wes
    Isberg and Mik Kersten
  • AJDT team
  • Matt Chapman, Andy Clement, Adrian Colyer, Mik
    Kersten and Julie Waterhouse
  • http//eclipse.org/aspectj
  • http//eclipse.org/ajdt
Write a Comment
User Comments (0)
About PowerShow.com