Summary
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.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
Rights and permissions
Copyright information
© 2005 Renaud Pawlak, Lionel Seinturier, and Jean-Philippe Retaillé
About this chapter
Cite this chapter
(2005). Design Patterns and AOP. In: Foundations of AOP for J2EE Development. Apress. https://doi.org/10.1007/978-1-4302-0063-5_8
Download citation
DOI: https://doi.org/10.1007/978-1-4302-0063-5_8
Publisher Name: Apress
Print ISBN: 978-1-59059-507-7
Online ISBN: 978-1-4302-0063-5
eBook Packages: Professional and Applied ComputingApress Access BooksProfessional and Applied Computing (R0)