Java Reference
In-Depth Information
8
WHAT'S IN THIS CHAPTER?
Introduction to aspect‐oriented programming
Aspects in Java
Using servlet i lters as aspects
Aspects in Java EE, interceptors
EJB interceptors versus CDI interceptors
WROX.COM CODE DOWNLOADS FOR THIS CHAPTER
The wrox.com code download for this chapter is found at www.wrox.com/go/
projavaeedesignpatterns on the Download Code tab. The code is in the Chapter 08
download and individually named according to the names throughout the chapter.
Aspect‐oriented programming (AOP) is not a new concept. Its place in Java and third‐party
frameworks was secured from the early days of enterprise development. Despite this, it was
not one of the classical design patterns listed in the GOF 1 book.
AOP introduced a new concept and paradigm to programming. The idea relies on basing the
code execution order on aspects. Each aspect intercepts the program's execution and adds its
own behavior before continuing with the call.
Aspects act like magic, adding further logic and behavior to the code at run time. However,
this also brings an ambiguous and hard‐to‐follow code execution order that can often result in
almost undebuggable code. AOP has many followers and fans, besides many haters.
Luckily, Java EE has a nice and clean implementation that can be helpful if it's used in the
right way and context.
 
Search WWH ::




Custom Search