| Stefan Hanenberg
Department of Mathematics & Computer Science University of Essen Schützenbahn 70, 45117 Essen, Germany Email shanenbe@cs.uni-essen.de URL: http://www.cs.uni-essen.de/dawis/shanenbe/ |
Keywords: Application Frameworks, Aspect-Orientation, Design Patterns
Classification: 1 year´s work
The flexible artifacts within a framework that can or even must be adapted by developers are called hot spots [Pre95], those that can’t or shouldn’t be changed are frozen spots. Usually the hot spots are abstract classes or interfaces which must be extended or implemented by the application developer. The main essence of frameworks is, that hot spots are invoked from within the framework itself (cf. [JoF88]) using certain design patterns like strategy, template method etc. (cf. [Gam+95]).
In fact application frameworks not only contain an abstract design and implementation of a domain, they also contain numerous concerns [Dij76] which influenced the framework's design and its functionality. For example a framework based on Enterprise JavaBeans contains numerous aspects [Blv98] and therefore can not be used for client-sided applications, even though it may depict the needed domain.
In [HFU00] we showed, how certain design patterns can be encapsulated using aspects and introduced our aspect framework sideFrame [Side00] based on the aspect language aspectJ (cf. [LoK98] ). This white box aspect framework contains pre-build design patterns which can be weaved to an existing primary structure by overriding abstract methods and pointcuts. The main benefit is, that by weaving design-aspects the implementations of patterns can be reused and on model level these patterns can be identified. Additional, these patterns can be weaved whenever needed without staining the inheritance structure of the participating classes.
By encapsulating design patterns into aspects there is no need any longer to keep certain design patterns within an object-oriented framework when not strictly prescribed by the domain. Instead object-oriented frameworks should additionally be supplied with an aspect framework which allows developers to add specific patterns. The main consequence of this approach is, that object-oriented frameworks become more flexible, because application developer decide which patterns to use in what situations. Another effect of separating design patterns as concerns is, that documenting frameworks becomes more easier of the fact, that interfaces within the framework become more understandable.
a)
b)
c)
Figure 1: a) simple framework, b) including oberserver / observable, c) adopted simple framework
When separating design concerns within an aspect framework and supplying it in addition, the framework can satisfy both customers' needs. Adding observable- and observer-properties to Booking and Account means in sideframe to extend the generic aspects of the participants within the observer pattern (GenericSubject and GenericObserver) and set Account and Booking as join points (figure 2). The generic aspects contain the needed behavior and interaction of the pattern like attaching the observer to the subject and informing the observer whenever the subject's state changes. So the framework's design can be adopted to the developers' needs.
Figure 2: Adopting simple Multi-Design Framework
[CzE00] Czarnecki, Krzysztof und Ulrich W. Eisenecker: Generative Programming: Methods, Tools, and Application, Addison-Wesley, 2000
[Dij76] Dijkstra, Edsger W.: A Discipline of Programming. Prentice-Hall. 1976
[Gam+95] Gamma, Erich, Helm, Richard, Johnson, Ralph E., Vlissides, John: Design Patterns: Elements of Reusable Object-Oriented Software, Addison-Wesley. 1995.
[HFU00] Hanenberg, Stefan, Franczyk, Bogdan, Unland, Rainer, Aspect Frameworks: How aspect-orientation an smoothly support the evolution process of software, submitted
[JoF88] Johnson, Ralph E. , Foote, Brian , Designing reusable classes. Journal of Object-Oriented Programming, 1(5), 1988, pp. 22-35
[Kic+97] Kiczales, Gregor, John Lamping, Anurag Mendhekar, Chris Maeda, Cristina Videira Lopes, Jean-Marc Loingtier und John Irwin: Aspect-Oriented Programming. In: Aksit, Mehmet (Hg.): Proceedings of ECOOP'97. Springer-Verlag. 1997
[LoK98] Cristina Videira Lopes and Gregor Kiczales, Recent Developments in AspectJ™, Aspect-Oriented Programming (AOP) Workshop at ECOOP’98. 1998
[Pre95] Pree, W.; Design Patterns for Object-Oriented Software Development. Addison-Wesley, Reading, MA, 1995
[Side00] SideFrame: Simple Design Pattern Framework, Homepage, http://www.cs.uni-essen.de/dawis/research/sideframe/
[Sou95] J. Soukup, Implementing Patterns. In: J.O. Couplin, D.C. Schmidt (eds.): Pattern Languages of Program Design, Addison-Wesley, 1995.