Professional Documents
Culture Documents
and Paradigms
Aspect Oriented Programming
Introduction
Currently, the dominant programming paradigm is object-
oriented programming that:
has been presented as a technology that can
fundamentally aid software engineering
is reflected in the entire spectrum of current software
development methodologies and tools
Code scattering
Duplicated code blocks
Functional
business rules and constraints
Difficult to change
have to find all the code involved
Object
decomposition
is flatland
concerns
AOP: Opening a New Dimension in
Software Development
Object
decomposition
is flatland
Aspects are
aspect
orthogonal to the
primary decomposition
concerns
Expected Benefits of AOP
Good modularity, even for crosscutting
concerns
less tangled code
more natural code
shorter code
easier maintenance and evolution
easier to reason about, debug, change
more reusable
library aspects
plug and play aspects when appropriate
AOP Basic Concepts
The following are some of the fundamental
ideas in AOP
Aspect
Advice
Joinpoint
Pointcut
Target
Weaving
Aspect
Aspect - Think of this as the general
feature you want to apply globally to your
application
Logging
performance monitoring
exception handling
DB session/transaction management
E.g. Hibernate transaction handling via Spring
Advice
Advice - A chunk of code that is invoked
during program execution, and is a piece
of the logic for implementing your aspect
keywords
AOP in Java
Add-on libraries
JBossAOP, SpringAOP, AspectWerkz