Capítulo de livro Revisado por pares

Wrappers to the rescue

1998; Springer Science+Business Media; Linguagem: Inglês

10.1007/bfb0054101

ISSN

1611-3349

Autores

John Brant, Brian Foote, Ralph E. Johnson, Donald F. Roberts,

Tópico(s)

Software Testing and Debugging Techniques

Resumo

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.

Referência(s)