Software design patterns offer flexible solutions to common software
development problems. Each pattern is comprised of a number of parts,
including purpose/intent, applicability, structure, and sample
implementations. A number of patterns involve crosscutting structures in
the relationship between roles in the pattern and classes in each instance
of the pattern. When the GoF first identified software design patterns,
the sample implementations
were geared to the current state of the art in object-oriented languages.
Other work has shown that implementation language affects pattern
implementation, so it seems natural to explore the effect of aspect-oriented
programming techniques on the implementation of design patterns.
As an initial experiment we chose to develop and compare Java and AspectJ
implementations of the 23 GoF patterns. We are not discovering new patterns,
but simply working out how implementations of the GoF patterns can be handled
using a new implementation tool. Our results indicate that using AspectJ
improves the implementation of many GoF patterns. The observed benefits are related
to improved modularity of the code: localized implementation, (un)pluggability
of pattern code, transparent composition of multiple pattern instances, and
even reusable pattern impelmentations.
The Java and AspectJ implementations of the GoF patterns are available for download.
For more information see our
main AODPs page.
- Jan Hannemann
- Gregor Kiczales
Jan Hannemann and Gregor Kiczales.
"Design Pattern Implementations in Java and AspectJ",