Design Patterns and AOP
- … show all 0 hide
In this chapter, we presented the aspect-oriented implementation of five well-known design patterns: Singleton, Observer, Command, Chain of Responsibility, and Proxy.
For these five cases, the implementation follows this principle: an abstract aspect is defined to hold the code that is generic in the implementation of the pattern. This abstract aspect defines abstract pointcuts that designate the locations in the program where the pattern is to be integrated and the conditions under which the pattern must be triggered. This abstract aspect is then extended to define the code, which is specific to, for example, a command or a proxy.
The aspect-oriented implementations of these five design patterns lead to solutions that are more interesting than pure object-oriented, aspect-free implementations. It is, however, not the case for all existing design patterns. Patterns such as the Factory pattern or the Inter- preter pattern do not benefit as much from aspects.
Deciding whether a design pattern will benefit from an aspect-oriented implementation is a matter of evaluating whether
• The pattern defines a crosscutting structure.
• The four criteria of locality, reusability, composition transparency, and (un)pluggability defined by Hannemann and Kiczales are met.
• The pattern leaves the structure of the base program unchanged.
- Design Patterns and AOP
- Book Title
- Foundations of AOP for J2EE Development
- pp 149-170
- Print ISBN
- Online ISBN
- Copyright Holder
- Renaud Pawlak, Lionel Seinturier, and Jean-Philippe Retaillé
- Additional Links
- Industry Sectors
- eBook Packages
To view the rest of this content please follow the download PDF link above.