Chapter 6. Aspects: putting it all together
This chapter covers
- Formally introducing aspects
- Creating reusable aspects with aspect association
- Using aspect precedence to coordinate multiple aspects
- Bypassing access-specification rules using privileged aspects
Aspects represent the unit of modularization in AOP and AspectJ. They provide a way to include crosscutting constructs such as pointcuts and advice. You’ve already seen quite a few aspects in the preceding chapters’ examples.
In this chapter, we’ll take a closer look at the core aspect construct. We’ll begin by examining the aspect construct in a formal way and compare it to the class—the most similar concept in object-oriented programming. Next, we’ll examine the aspect association that provides a mechanism needed to write reusable aspects. We’ll follow that by considering the effects of multiple aspects in a system advising the same join point, and ways to control ordering. We’ll complete this chapter by examining a way aspects can override the standard access-specification rules.