Classboxes: controlling visibility of class extensions

A class extension is a method that is defined in a module, but whose class is defined elsewhere. Class extensions offer a convenient way to incrementally modify existing classes when subclassing is inappropriate. Unfortunately existing approaches suffer from various limitations. Either class extensi...

Full description

Saved in:
Bibliographic Details
Published inComputer languages, systems & structures Vol. 31; no. 3; pp. 107 - 126
Main Authors Bergel, Alexandre, Ducasse, Stéphane, Nierstrasz, Oscar, Wuyts, Roel
Format Journal Article
LanguageEnglish
Published Elsevier Ltd 01.10.2005
Elsevier
Subjects
Online AccessGet full text

Cover

Loading…
More Information
Summary:A class extension is a method that is defined in a module, but whose class is defined elsewhere. Class extensions offer a convenient way to incrementally modify existing classes when subclassing is inappropriate. Unfortunately existing approaches suffer from various limitations. Either class extensions have a global impact, with possibly negative effects for unexpected clients, or they have a purely local impact, with negative results for collaborating clients. Furthermore, conflicting class extensions are either disallowed, or resolved by linearization, with consequent negative effects. To solve these problems we present classboxes, a module system for object-oriented languages that provides for method addition and replacement. Moreover, the changes made by a classbox are only visible to that classbox (or classboxes that import it), a feature we call local rebinding. To validate the model we have implemented it in the Squeak Smalltalk environment, and performed benchmarks.
ISSN:1477-8424
1873-6866
DOI:10.1016/j.cl.2004.11.002