Journal of Information Processing
Online ISSN : 1882-6652
ISSN-L : 1882-6652
A Layer-based Approach to Hierarchical Dynamically-scoped Open Classes
Matthias SpringerHidehiko MasuharaRobert Hirschfeld
Author information
JOURNAL FREE ACCESS

2017 Volume 25 Pages 296-307

Details
Abstract

Open classes are frequently used in programming languages such as Ruby and Smalltalk to add or change methods of a class that is defined in the same component or in a different one. They are typically used for bug fixing, multi-dimensional separation of concerns, or to modularly add new operations to an existing class. However, they suffer from modularity issues if globally visible: Other components using the same classes are then affected by their modifications. This work presents Extension Classes, a hierarchical approach for dynamically scoping such modifications in Ruby, built on top of ideas from Context-oriented Programming (COP). Our mechanism organizes modifications in classes and allows programmers to define their scope according to a class nesting hierarchy and based on whether programmers regard an affected class as a black box or not. Moreover, Extension Classes support modularizing modifications as mixins, such that they can be reused in other components.

Content from these authors
© 2017 by the Information Processing Society of Japan
Previous article Next article
feedback
Top