6. Table of Contents
‣ Why Aspect-Oriented Programming?
‣ Basic AOP Concepts
‣ Getting Started with Spring AOP
7. Table of Contents
‣ Why Aspect-Oriented Programming?
‣ Basic AOP Concepts
‣ Getting Started with Spring AOP
‣ Benefits and Drawbacks
8. Table of Contents
‣ Why Aspect-Oriented Programming?
‣ Basic AOP Concepts
‣ Getting Started with Spring AOP
‣ Benefits and Drawbacks
‣ When to Use Spring AOP?
25. AOP Terminology
‣ An aspect is a module that encapsulates advice and pointcuts
‣ An advice is code to be executed at a join point selected by a pointcut
26. AOP Terminology
‣ An aspect is a module that encapsulates advice and pointcuts
‣ An advice is code to be executed at a join point selected by a pointcut
‣ A pointcut is an expression that selects one or more join points
27. AOP Terminology
‣ An aspect is a module that encapsulates advice and pointcuts
‣ An advice is code to be executed at a join point selected by a pointcut
‣ A pointcut is an expression that selects one or more join points
‣ A join point is a point in the execution of a program
30. Calls on the object reference will be calls on the proxy and the proxy
delegates to all of the relevant advices
31. Regular method invocation
Calls on the object reference will be calls on the proxy and the proxy
delegates to all of the relevant advices
32. Regular method invocation Proxied method invocation
Calls on the object reference will be calls on the proxy and the proxy
delegates to all of the relevant advices
33. Spring offers 3 ways to accomplish AOP support
Annotation based Schema based Schema based
with AspectJ with AspectJ without AspectJ
Very easy to Bloated
Easy to configure
configure configuration
Horizontal class Horizontal class Horizontal class
relationships at relationships at relationships at
code level deployment level deployment level
Degrades
Enables portability Enables portability
portability
39. AOP Suitability
Cost-effectiveness
Code reduction
Aspectizability
Obliviousness
Crosscutting
Concern
Evolvability
Modularity
Reliability
Logging V V V V V
Validation V V V V V V V ?
Transaction Management V V V V V V V V
Security V V V ? V ? ?
Caching V V V ? ? V ? V
40. Modularization of Schema based
cross cutting concerns aspect configuration
Auto-proxying for
aspect weaving
Summary
Notas del editor
Crosscutting. Does the concern have a crosscutting nature?
Aspectizability. Can the concern be resolved by AOP?
Obliviousness. Is neither the existence nor the execution of the Aspect code apparent by examining the base code (Which allows greater Separation of Concerns)?
Code reduction. Does it reduce code?
Reliability. Does it reduce the chance of making mistakes?
Modularity. Does it reduce tangling (multiple concerns intermixed) and scattering (spread of code for a concern)?
Evolvability. Does it make it easier to modify the implementation when requirements change?
Cost-effectiveness. Do the benefits (Code Reduction, Reliability, Modularity, Evolvability) outweigh the costs (possible increase of complexity and/or decrease of performance)?