Technical Report


From Inheritance to Feature Interaction or Composing Monads


Author(s): Christian Prehofer
Year: 1997
Number: TUM-I9715
Editor:
CR Classification: D.1.5, F.3.3, D.1.1, D.2.2, D.3.3
CR General Terms: Functional Programming, OO-Programming
Keywords: Functional Programming, Monads, Object-oriented Programming, Inheritance, Feature Interaction
Abstract: We show that techniques for monad composition can be used nicely for modeling object-oriented programming concepts. In this functional setting, we develop a new model for composing objects from individual features in a modular way. Features are similar to abstract subclasses, but separate the core functionality of a subclass from overwriting methods. We view method overwriting more generally as resolving interactions between two features. The interaction handling is specified separately and added when features are composed. This generalizes inheritance as found in object-oriented languages and leads to a new view of objects in a functional setting. Our concepts are implemented in Gofer and generalize some monadic programming techniques, where objects correspond to monads, features to monad transformers, and feature interactions are resolved by lifting functions through monad transformers.


Available as compressed Postscript

BibTeX-Entry:

@techreport{ TUM-I9715, author = {Christian Prehofer}, title = {From Inheritance to Feature Interaction or Composing Monads}, number = {TUM-I9715}, institution = {Technische Univerit\"at M\"unchen}, year = {1997}, url = {http://www4.informatik.tu-muenchen.de/reports/TUM-I9715.html}, abstract = { We show that techniques for monad composition can be used nicely for modeling object-oriented programming concepts. In this functional setting, we develop a new model for composing objects from individual features in a modular way. Features are similar to abstract subclasses, but separate the core functionality of a subclass from overwriting methods. We view method overwriting more generally as resolving interactions between two features. The interaction handling is specified separately and added when features are composed. This generalizes inheritance as found in object-oriented languages and leads to a new view of objects in a functional setting. Our concepts are implemented in Gofer and generalize some monadic programming techniques, where objects correspond to monads, features to monad transformers, and feature interactions are resolved by lifting functions through monad transformers. }, CRClassification = {D.1.5, F.3.3, D.1.1, D.2.2, D.3.3}, CRGenTerms = {Functional Programming, OO-Programming} }