Title: Folie 1
1crosscutting objects for better modularity
AspectJ
Aleksandar Nikolic Taufan Zimmer Qin Huang June
23, 2004 HdM-Stuttgart
2Introduction
Introduction Aspect Oriented Programming(AOP)
3Introduction
Einführung zur AOP
- Was ist AOP?
- Wichtige Begriffe der AOP
- AOP vs. OOP
- Vorteile
- Unterstützung von Java
-
4Introduction
Was ist AOP?
- Abkürzung von Aspektorientierte Programmierung
- ein Paradigma für Design und Implementierung von
Softwaresystemen, das neue Arten von Modularität
zu Verfügung stellt. - basiert auf Aspekten
- an mehreren Stellen beeinflussen und somit
durchdringen (crosscutting concerns) -
5Introduction
Wichtige Begriffe von AOP
- Pointcuts
- Joinpoint
- Advices
-
A
d
v
i
c
e
A
u
t
h
e
n
t
i
f
i
z
i
e
r
u
n
g
T
r
a
n
s
a
k
t
i
o
n
E
i
n
z
a
h
l
u
n
g
J
o
i
n
p
o
i
n
t
K
o
n
t
o
A
u
s
z
a
h
l
u
n
g
P
o
i
n
t
c
u
t
6Introduction
AOP vs. OOP
- OOPBetrachten von Objekten als
Modularisierungseinheit.Crosscuting Concerns als
nicht modularisierbare Objekte (Aspekte) - AOPBetrachten von Aspekten als
Modularisierungseinheit.Crosscutting Concerns
als Aspekte modularisieren. - Debugging (Logging, Tracing, Monitoring)
- Transaktionsbehandlung
- Sicherheit (Authentifizierung, Autorisierung)
- Ausnahmebehandlung
-
7Introduction
AOP vs. OOP
8Introduction
Vorteile
- stärkere Modularisierung
- klarere Trennung der Verantwortung
- stärkere Wiederverwendung
- höhere Produktivität
9Introduction
Unterstützung mit Java
- AspectJ von Xerox
- HyperJ von IBM
10Introduction
Introduction AspectJ
11(No Transcript)
12(No Transcript)
13(No Transcript)
14Introduction
The 5 lifes of AspectJ
- Real crosscutting concerns
- Implementation of collaboration
- Software modification
- Development support
- Generative programming
- Source Die 5 Leben des AspectJ by Markus
Voelter and Martin Lippert
15Introduction
The 5 lifes of AspectJ
Aspect A
Real crosscutting concerns
Aspects affect a wide range of the system.
Class
Class
Class
. . .
Class with A
Class with A
Class with A
16Introduction
The 5 lifes of AspectJ
Aspect B
Aspect A
Real crosscutting concerns
Aspects affect a wide range of the system.
Class
Class
Class
. . .
Class with A
Class with A,B
Class with A,B
17Introduction
The 5 lifes of AspectJ
Aspect Observable
Aspect Observer
Implementation of collaboration
Dependencies add new functionality to certain
classes.
Class
Classes
Observable Class
Observer Class
Observable Class
collaboration
Observable Classes
18Introduction
The 5 lifes of AspectJ
AspectJ Compiler
Software modification
Aspect
Bytecode can be altered without source code.
modified Bytecode
modified Bytecode
modified Bytecode
Bytecode
19Introduction
The 5 lifes of AspectJ
Development
Production
Aspect Tracing
Aspect Tracing
Development support
Aspects may support developers and be removed in
production.
Class
Class
Class
Class
Class
Class
Class with tracing
Class with tracing
Class with tracing
20Introduction
The 5 lifes of AspectJ
Aspect Stored Procedures
Aspect Referential Integrity
Aspect Grid Distribution
Generative programming
Combining different aspects realizes generation
of product lines.
DB-App
DB-App with Referential Integrity Stored Proced
ures
DB-App with Referential Integrity
DB-App with Referential Integrity Stored Proced
ures Grid Distribution
21Technology
22Class
new function
new function
Class
Class
23Code weaving in AspectJ
Aspect- Class
Aspect- Class
function
function
call
Class
new function
Class
Class
new function
call
new function
new function
24Plugins for different IDEs like Eclipse,
JBuilder, SunONE / NetBeans, Emacs and JDEE are
available on the main project website. Still, the
compiler can be used with traditional command
line arguments and is therefore completely
tool-independent.
C\AJCgtajc.exe argfile default.lst_
25Java Compiler
Java- Source
.java
javac
26AspectJ Compiler
AspectJ Compiler
AspectJ- Source
the AspectJ compiler is both compiler and
bytecode manipulator. The compiler translates
Aspects into bytecode-classes and weaves
references to aspects into existing
bytecode. Thus, programmers dont require the
knowledge about the internal logic of the Java
Virtual Machine (JVM).
.aj
OR
27AspectJ Compiler internal process
28Language
Language
29Language
30field setjoin point
field reference join point
method call or executionjoin point
handler execution join point
constructor call or execution join point
field setjoin point
31(No Transcript)
32(No Transcript)
33(No Transcript)
34(No Transcript)
35(No Transcript)
36(No Transcript)
37(No Transcript)
38(No Transcript)
39Conclusion
Conclusion
40Conclusion
41Conclusion
42References
References
43(No Transcript)
44References
Authors
Aleksandar Nikolic an05_at_hdm-stuttgart.de Taufan
Zimmer tz03_at_hdm-stuttgart.de Qin
Huang qh01_at_hdm-stuttgart.de
45Vielen Dank für Ihre Aufmerksamkeit!
Fragen