Evolution of object behavior using context relations
Linda M. Seiter, Jens Palsberg, Karl J. Lieberherr · 1996
A collection of design patterns was described by Gamma, Helm, Johnson, and Vlissides in 1994. Recognizing that designs change, each pattern ensures that a certain system aspect can vary over time such as the operations that can be applied to an object or the algorithm of a method. The patterns are described by constructs such as the inheritance and reference relations, attempting to emulate more dynamic relationships. As a result, the design patterns demonstrate how awkward it is to program natural concepts of behavioral evolution when using a traditional object-oriented language.In this paper we present a new relation between classes: the context relation. It directly supports behavioral evolution, and it is meaningful at the analysis, design, and implementation level. At the design level we picture a context relation as a new form of arrow between classes. At the implementation level we use a small extension of C++. The basic idea is that if class C is context-related to a base class B, then B-objects can get their functionality dynamically altered by C-objects. Our language construct for doing this is a generalization of the method update in Abadi and Cardelli's imperative object calculus. A C-object may be explicitly attached to a B-object, or it may be implicitly attached to a group of B-objects for the duration of a method invocation. We demonstrate how the context relation can be used to easily model and program the Adapter, Bridge, Chain of Responsibility, Decorator, Iterator, Observer, State, Strategy, and Visitor patterns.
Cited by 30 works. doi:10.1145/239098.239108 Open-access PDF
Authors
References
- Design Patterns: Elements of Reusable Object-Oriented Software
- Object-oriented modeling and design
- The Annotated C++ Reference Manual
- Object oriented design with applications
- Designing reusable classes
- Self: The power of simplicity
- The art of the metaobject protocol
- Using prototypical objects to implement shared behavior in object-oriented systems
- The Art of the Metaobject Protocol
- Contracts: specifying behavioral compositions in object-oriented systems