Wrappers to the Rescue

Wrappers are mechanisms for introducing new behavior that is executed before and/or after, and perhaps even in lieu of, an existing method. This paper examines several ways to implement wrappers in Smalltalk, and compares their performance. Smalltalk programmers often use Smalltalk's lookup failure mechanism to customize method lookup. Our focus is different. Rather than changing the method lookup process, we modify the method objects that the lookup process returns. We call these objects method wrappers. We have used method wrappers to construct several program analysis tools: a coverage tool, a class collaboration tool, and an interaction diagramming tool. We also show how we used method wrappers to construct several extensions to Smalltalk: synchronized methods, assertions, and multimethods. Wrappers are relatively easy to build in Smalltalk because it was designed with reflective facilities that allow programmers to intervene in the lookup process. Other languages differ in the degree to which they can accommodate change. Our experience testifies to the value, power, and utility of openness.

[1]  David A. Moon,et al.  The Lisp Machine manual , 1981, SGAR.

[2]  Glenn Krasner,et al.  Smalltalk-80: bits of history, words of advice , 1983 .

[3]  Geoffrey A. Pascoe Encapsulators: A New Software Paradigm in Smalltalk-80 , 1986, OOPSLA.

[4]  J. Bennett The design and implementation of distributed Smalltalk , 1987, OOPSLA '87.

[5]  Paul L. McCullough Transparent forwarding: First steps , 1987, OOPSLA '87.

[6]  Mark Van Gulik,et al.  Building a backtracking facility in smalltalk without kernel support , 1988, OOPSLA 1988.

[7]  Daniel G. Bobrow,et al.  Common lisp object system specification , 1988, SIGP.

[8]  Wilf R. LaLonde,et al.  Building a backtracking facility in smalltalk without kernel support , 1988, OOPSLA '88.

[9]  Ralph E. Johnson,et al.  Reflective facilities in Smalltalk-80 , 1989, OOPSLA '89.

[10]  Bjarne Stroustrup,et al.  The Annotated C++ Reference Manual , 1990 .

[11]  Jürgen Herczeg,et al.  What tracers are made of , 1990, OOPSLA/ECOOP '90.

[12]  Bertrand Meyer,et al.  Eiffel: The Language , 1991 .

[13]  R. Hinkle,et al.  Taking exception to Smalltalk , 1992 .

[14]  Gregor Kiczales,et al.  Issues in the Design and Documentation of Class Libraries , 1992, OOPSLA.

[15]  Daniel G. Bobrow,et al.  Book review: The Art of the MetaObject Protocol By Gregor Kiczales, Jim des Rivieres, Daniel G. and Bobrow(MIT Press, 1991) , 1991, SGAR.

[16]  Michael D. Tiemann Solving the RPC problem in GNU C , 1993 .

[17]  Bjarne Stroustrup,et al.  The Design and Evolution of C , 1994 .

[18]  Ralph Johnson,et al.  design patterns elements of reusable object oriented software , 2019 .

[19]  Ernesto Pimentel,et al.  Eiffel-like Assertions and Private Methods in Smalltalk , 1994, TOOLS.

[20]  Rachid Guerraoui,et al.  Implementation of the GARF replicated objects platform , 1995, Distributed Syst. Eng..

[21]  Danny B. Lange,et al.  Interactive visualization of design patterns can help in framework understanding , 1995, OOPSLA.

[22]  Guy L. Steele,et al.  The Java Language Specification , 1996 .

[23]  Rachid Guerraoui,et al.  Garf: a tool for programming reliable distributed applications , 1997, IEEE Concurrency.