article

Scalable extensibility via nested inheritance

Published:01 October 2004Publication History

Abstract

Inheritance is a useful mechanism for factoring and reusing code. However, it has limitations for building extensible systems. We describe <i>nested inheritance</i>, a mechanism that addresses some of the limitations of ordinary inheritance and other code reuse mechanisms. Using our experience with an extensible compiler framework, we show how nested inheritance can be used to construct highly extensible software frameworks. The essential aspects of nested inheritance are formalized in a simple object-oriented language with an operational semantics and type system. The type system of this language is sound, so no run-time type checking is required to implement it and no run-time type errors can occur. We describe our implementation of nested inheritance as an unobtrusive extension of the Java language, called Jx. Our prototype implementation translates Jx code to ordinary Java code, without duplicating inherited code.

References

  1. Davide Ancona, Giovanni Lagorio, and Elena Zucca. Jam: A smooth extension of Java with mixins. In Proc. ECOOP '00, LNCS 1850, pages 154--178, Cannes, France, 2000.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. Gilad Bracha and William Cook. Mixin-based inheritance. In Norman Meyrowitz, editor, Proc. OOPSLA '90, pages 303--311, Ottawa, Canada, 1990. ACM Press.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. Kim B. Bruce, Adrian Fiech, and Leaf Petersen. Subtyping is not a good "match" for object-oriented languages. In Proceedings of 11th European Conference on Object-Oriented Programming (ECOOP'97), number 1241 in Lecture Notes in Computer Science, pages 104--127, Jyväskylä, Finland, June 1997. Springer-Verlag.]]Google ScholarGoogle ScholarCross RefCross Ref
  4. Kim B. Bruce, Martin Odersky, and Philip Wadler. A statically safe alternative to virtual types. In European Conference on Object-Oriented Programming (ECOOP), number 1445 in Lecture Notes in Computer Science, pages 523--549, Brussels, Belgium, July 1998. Springer-Verlag.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. Kim B. Bruce, Angela Schuett, and Robert van Gent. PolyTOIL: A type-safe polymorphic object-oriented language. In European Conference on Object-Oriented Programming (ECOOP), number 952 in Lecture Notes in Computer Science, pages 27--51. Springer-Verlag, 1995.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. Curtis Clifton, Gary T. Leavens, Craig Chambers, and Todd Millstein. MultiJava: Modular open classes and symmetric multiple dispatch for Java. In OOPSLA 2000 Conference on Object-Oriented Programming, Systems, Languages, and Applications, Minneapolis, Minnesota, volume 35(10), pages 130--145, 2000.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. O.-J. Dahl et al. The Simula 67 common base language. Publication No. S-22, Norwegian Computing Center, Oslo, 1970.]]Google ScholarGoogle Scholar
  8. Erik Ernst. gbeta - a Language with Virtual Attributes, Block Structure, and Propagating, Dynamic Inheritance. PhD thesis, Department of Computer Science, University of Aarhus, Århus, Denmark, 1999.]]Google ScholarGoogle Scholar
  9. Erik Ernst. Family polymorphism. In Proceedings of the 15th European Conference on Object-Oriented Programming (ECOOP), LNCS 2072, pages 303--326, Heidelberg, Germany, 2001. Springer-Verlag.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. Erik Ernst. Higher-order hierarchies. In Proceedings of the 17th European Conference on Object-Oriented Programming (ECOOP), volume 2743 of Lecture Notes in Computer Science, pages 303--329, Heidelberg, Germany, July 2003. Springer-Verlag.]]Google ScholarGoogle ScholarCross RefCross Ref
  11. Matthew Flatt, Shriram Krishnamurthi, and Matthias Felleisen. Classes and mixins. In Proc. 25th ACM Symp. on Principles of Programming Languages (POPL), pages 171--183, San Diego, California, 1998.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides. Design Patterns: Elements of Reusable Object-Oriented Software. Addison Wesley, Reading, MA, 1994.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. James Gosling, Bill Joy, Guy Steele, and Gilad Bracha. The Java Language Specification. Addison Wesley, 2nd edition, 2000. ISBN 0-201-31008-2.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Carl Gunter and John C. Mitchell, editors. Theoretical aspects of object-oriented programming. MIT Press, 1994.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. Atsushi Igarashi, Benjamin Pierce, and Philip Wadler. Foundations for virtual types. In Proceedings of the Thirteenth European Conference on Object-Oriented Programming (ECOOP'99), number 1628 in Lecture Notes in Computer Science, pages 161--185. Springer-Verlag, June 1999.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. Atsushi Igarashi, Benjamin Pierce, and Philip Wadler. Featherweight Java: A minimal core calculus for Java and GJ. ACM Transactions on Programming Languages and Systems, 23(3):396--450, 2001.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. Atsushi Igarashi and Benjamin C. Pierce. On inner classes. Information and Computation, 177(1):56--89, August 2002.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Gregor Kiczales, Erik Hilsdale, Jim Hugunin, Mik Kersen, Jeffrey Palm, and William G. Griswold. An overview of AspectJ. In Proceedings of European Conference on Object-Oriented Programming (ECOOP'01), volume 2072 of Lecture Notes in Computer Science, pages 327--353, Berlin, Heidelberg, and New York, 2001. Springer-Verlag.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. Gregor Kiczales, John Lamping, Anurag Mendhekar, Chris Maeda, Cristina Videira Lopes, Jean-Marc Loingtier, and John Irwin. Aspect-oriented programming. In Proceedings of 11th European Conference on Object-Oriented Programming (ECOOP'97), number 1241 in Lecture Notes in Computer Science, pages 220-242, Jyväskylä, Finland, June 1997. Springer-Verlag.]]Google ScholarGoogle ScholarCross RefCross Ref
  20. B. Liskov et al. CLU reference manual. In Goos and Hartmanis, editors, Lecture Notes in Computer Science, volume 114. Springer-Verlag, Berlin, 1981.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. O. Lehrmann Madsen, B. Moller-Pedersen, and K. Nygaard. Object Oriented Programming in the BETA Programming Language. Addison-Wesley, June 1993.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. Ole Lehrmann Madsen and Birger Moller-Pedersen. Virtual classes: A poweful mechanism for object-oriented programming. In Proc. OOPSLA '89, pages 397--406, October 1989.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. Sean McDirmid, Matthew Flatt, and Wilson C. Hsieh. Jiazzi: New-age components for old-fashioned Java. In Proc. OOPSLA '01, October 2001.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. Robin Milner, Mads Tofte, and Robert Harper. The Definition of Standard ML. MIT Press, Cambridge, MA, 1990.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. Andrew C. Myers, Lantian Zheng, Steve Zdancewic, Stephen Chong, and Nathaniel Nystrom. Jif: Java information flow. Software release. Located at http://www.cs.cornell.edu/jif, July 2001-2003.]]Google ScholarGoogle Scholar
  26. Nathaniel Nystrom, Stephen Chong, and Andrew C. Myers. Scalable extensibility via nested inheritance. Technical Report 2004-1940, Computer Science Dept., Cornell University, June 2004.]]Google ScholarGoogle Scholar
  27. Nathaniel Nystrom, Michael Clarkson, and Andrew C. Myers. Polyglot: An extensible compiler framework for Java. In Görel Hedin, editor, Compiler Construction, 12th International Conference, CC 2003, number 2622 in Lecture Notes in Computer Science, pages 138--152, Warsaw, Poland, April 2003. Springer-Verlag.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. Martin Odersky, Philippe Altherr, Vincent Cremet, Burak Emir, Sebastian Maneth, Stephane Micheloud, Nikolay Mihaylov, Michel Schinz, Erik Stenman, and Matthias Zenger. An overview of the Scala programming language, June 2004. http://scala.epfl.ch/docu/files/-ScalaOverview.pdf.]]Google ScholarGoogle Scholar
  29. Martin Odersky, Vincent Cremet, Christine Röckl, and Matthias Zenger. A nominal theory of objects with dependent types. In Proceedings of 17th European Conference on Object-Oriented Programming (ECOOP 2003), number 2743 in Lecture Notes in Computer Science, pages 201--224. Springer-Verlag, July 2003.]]Google ScholarGoogle ScholarCross RefCross Ref
  30. Martin Odersky and Christoph Zenger. Nested types. In 8th Workshop on Foundations of Object-Oriented Languages (FOOL), 2001.]]Google ScholarGoogle Scholar
  31. Klaus Ostermann. Dynamically composable collaborations with delegation layers. In Proceedings of the 16th European Conference on Object-Oriented Programming (ECOOP), volume 2374 of Lecture Notes in Computer Science, pages 89--110, Málaga, Spain, 2002. Springer-Verlag.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. John C. Reynolds. User-defined types and procedural data structures as complementary approaches to data abstraction. In Stephen A. Schuman, editor, New Directions in Algorithmic Languages, pages 157--168. Institut de Recherche d'Informatique et d'Automatique, Le Chesnay, France, 1975. Reprinted in {14}, pages 13--23.]]Google ScholarGoogle Scholar
  33. Yannis Smaragdakis and Don Batory. Implementing layered design with mixin layers. In Eric Jul, editor, Proceedings ECOOP'98, pages 550--570, Brussels, Belgium, 1998.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  34. B. Stroustrup. The C++ Programming Language. Addison-Wesley, 1987.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  35. Kresten Krab Thorup. Genericity in Java with virtual types. In Proceedings of the European Conference on Object-Oriented Programming (ECOOP), number 1241 in Lecture Notes in Computer Science, pages 444--471. Springer-Verlag, 1997.]]Google ScholarGoogle ScholarCross RefCross Ref
  36. Mads Torgerson. Virtual types are statically safe. In 5th Workshop on Foundations of Object-Oriented Languages (FOOL), January 1998.]]Google ScholarGoogle Scholar
  37. Andrew K. Wright and Matthias Felleisen. A syntactic approach to type soundness. Information and Computation, 115(1):38--94, 1994.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  38. Matthias Zenger and Martin Odersky. Extensible algebraic datatypes with defaults. In Proc. 6th ACM SIGPLAN International Conference on Functional Programming (ICFP), Firenze, Italy, September 2001.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  39. Matthias Zenger and Martin Odersky. Independently extensible solutions to the expression problem. Technical Report IC/2004/33, École Polytechnique Fédérale de Lausanne, March 2004.]]Google ScholarGoogle Scholar

Index Terms

  1. Scalable extensibility via nested inheritance

            Comments

            Login options

            Check if you have access through your login credentials or your institution to get full access on this article.

            Sign in

            Full Access

            • Published in

              cover image ACM SIGPLAN Notices
              ACM SIGPLAN Notices  Volume 39, Issue 10
              OOPSLA '04
              October 2004
              448 pages
              ISSN:0362-1340
              EISSN:1558-1160
              DOI:10.1145/1035292
              Issue’s Table of Contents
              • cover image ACM Conferences
                OOPSLA '04: Proceedings of the 19th annual ACM SIGPLAN conference on Object-oriented programming, systems, languages, and applications
                October 2004
                462 pages
                ISBN:1581138318
                DOI:10.1145/1028976

              Copyright © 2004 ACM

              Publisher

              Association for Computing Machinery

              New York, NY, United States

              Publication History

              • Published: 1 October 2004

              Check for updates

              Qualifiers

              • article

            PDF Format

            View or Download as a PDF file.

            PDF

            eReader

            View online with eReader.

            eReader
            About Cookies On This Site

            We use cookies to ensure that we give you the best experience on our website.

            Learn more

            Got it!