skip to main content
10.1145/1167473.1167477acmconferencesArticle/Chapter ViewAbstractPublication PagessplashConference Proceedingsconference-collections
Article

Statically scoped object adaptation with expanders

Published:16 October 2006Publication History

ABSTRACT

This paper introduces the expander, a new object-oriented (OO) programming language construct designed to support object adaptation. Expanders allow existing classes to be noninvasively updated with new methods, fields, and superinterfaces. Each client can customize its view of a class by explicitly importing any number of expanders. This view then applies to all instances of that class, including objects passed to the client from other components. A form of expander overriding allows expanders to interact naturally with OO-style inheritance.We describe the design, implementation, and evaluation of eJava, an extension to Java supporting expanders. We illustrate eJava's syntax and semantics through several examples. The statically scoped nature of expander usage allows for a modular static type system that prevents several important classes of errors. We describe this modular static type system informally, formalize eJava and its type system in an extension to Featherweight Java, and prove a type soundness theorem for the formalization. We also describe a modular compilation strategy for eJava, which we have implemented using the Polyglot extensible compiler framework. Finally, we illustrate the practical benefits of eJava by using this compiler in two experiments.

References

  1. G. Baumgartner, M. Jansche, and K. Laufer. Half & Half: Multiple dispatch and retroactive abstraction for Java. Technical Report OSU-CISRC-5/01-TR08, Department of Computer and Information Science, The Ohio State University, revised March 2002.]]Google ScholarGoogle Scholar
  2. A. Bergel. Personal communication, Oct. 2005.]]Google ScholarGoogle Scholar
  3. A. Bergel, S. Ducasse, and O. Nierstrasz. Classbox/J: Controlling the scope of change in Java. In Proceedings of Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA'05), pages 177--189, New York, NY, USA, 2005. ACM Press.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. A. Bergel, S. Ducasse, and R. Wuyts. Classboxes: A minimal module model supporting local rebinding. In Proceedings of JMLC 2003 (Joint Modular Languages Conference), volume 2789 of LNCS, pages 122--131. Springer-Verlag, 2003. Best Award Paper.]]Google ScholarGoogle ScholarCross RefCross Ref
  5. G. Bracha and W. Cook. Mixin-based inheritance. In ECOOP/OOPSLA '90, pages 303--311, 1990.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. C. Clifton, G. T. Leavens, C. Chambers, and T. 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) of ACM SIGPLAN Notices, pages 130--145, Oct. 2000.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. C. Clifton, T. Millstein, G. T. Leavens, and C. Chambers. MultiJava: Design rationale, compiler implementation, and applications. ACM Trans. Program. Lang. Syst., 28(3):517--575, 2006.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. Eclipse home page. http://www.eclipse.org.]]Google ScholarGoogle Scholar
  9. Eclipse Bug System home page. https://bugs.eclipse.org/bugs.]]Google ScholarGoogle Scholar
  10. E. Ernst. Family polymorphism. In Proceedings of the European Conference on Object-Oriented Programming, pages 303--326, 2001.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. E. Ernst. Higher-order hierarchies. In Proceedings of the European Conference on Object-Oriented Programming, LNCS, Darmstadt, Germany, July 2003. Springer Verlag.]]Google ScholarGoogle Scholar
  12. R. B. Findler and M. Flatt. Modular object-oriented programming with units and mixins. In Proceedings of the ACM SIGPLAN International Conference on Functional Programming (ICFP '98), volume 34(1) of ACM SIGPLAN Notices, pages 94--104. ACM, June 1998.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. M. Flatt, S. Krishnamurthi, and M. Felleisen. Classes and mixins. In Conference Record of POPL 98: The 25TH ACM SIGPLAN -SIGACT Symposium on Principles of Programming Languages, San Diego, California, pages 171--183, New York, NY, 1998.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. E. Gamma and K. Beck. Contributing to Eclipse: Principles, Patterns, and Plugins. Addison Wesley Longman Publishing Co., Inc., Redwood City, CA, USA, 2003.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. E. Gamma, R. Helm, R. E. Johnson, and J. Vlissides. Design Patterns: Elements of Reusable Object-Oriented Software. Addison-Wesley, Massachusetts, 1995.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. J. Gosling, B. Joy, G. Steele, and G. Bracha. The Java Language Specification, Third Edition. Addison-Wesley, 2005.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. W. Harrison and H. Ossher. Subject-oriented programming (A critique of pure objects). In A. Paepcke, editor, Proceedings ACM Conference on Object-Oriented Programming Systems, Languages, and Applications, pages 411--428. ACM Press, Oct. 1993.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. A. Igarashi, B. C. Pierce, and P. Wadler. Featherweight Java: a minimal core calculus for Java and GJ. ACM Transactions on Programming Languages and Systems, 23(3):396--450, May 2001.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. G. Kiczales, E. Hilsdale, J. Hugunin, M. Kersten, J. Palm, and W. G. Griswold. An overview of AspectJ. In Proceedings of the 2001 European Conference on Object-Oriented Programming, LNCS 2072, Budapest, Hungary, June 2001. Springer-Verlag.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. S. McDirmid, M. Flatt, and W. C. Hsieh. Jiazzi: New-age components for old-fashioned Java. In Proceedings of the OOPSLA '01 conference on Object Oriented Programming Systems Languages and Applications, pages 211--222. ACM Press, 2001.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. N. Nystrom, S. Chong, and A. C. Myers. Scalable extensibility via nested inheritance. In OOPSLA '04: Proceedings of the 19th annual ACM SIGPLAN Conference on Object-oriented programming, systems, languages, and applications, pages 99--115. ACM Press, 2004.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. N. Nystrom, M. R. Clarkson, and A. C. Myers. Polyglot: An extensible compiler framework for Java. In Proceedings of CC 2003: 12'th International Conference on Compiler Construction. Springer-Verlag, Apr. 2003.]]Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. M. Odersky and M. Zenger. Scalable component abstractions. In OOPSLA '05: Proceedings of the 20th annual ACM SIGPLAN conference on Object oriented programming systems languages and applications, pages 41--57, New York, NY, USA, 2005. ACM Press.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. H. Ossher, M. Kaplan, A. Katz, W. Harrison, and V. Kruskal. Specifying subject-oriented composition. Theor. Pract. Object Syst., 2(3):179--202, 1996.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. H. Ossher and P. Tarr. Hyper/J: Multi-dimensional separation of concerns for Java. In Proceedings of the 22nd International Conference on Software Engineering, June 4-11, 2000, Limerick, Ireland, pages 734--737, 2000.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. Polyglot for Java 1.5 home page. http://www.sable.mcgill.ca/~jlhotak/polyglot-custom.]]Google ScholarGoogle Scholar
  27. The Scala language home page. http://scala.epfl.ch.]]Google ScholarGoogle Scholar
  28. N. Schärli, S. Ducasse, O. Nierstrasz, and A. Black. Traits: Composable units of behavior. In Proceedings ECOOP 2003 (European Conference on Object-Oriented Programming), volume 2743 of LNCS, pages 248--274. Springer Verlag, July 2003.]]Google ScholarGoogle ScholarCross RefCross Ref
  29. Y. Smaragdakis and D. Batory. Implementing layered designs with mixin layers. In E. Jul, editor, ECOOP '98 Object-Oriented Programming, LNCS 1445, pages 550--570. Springer, 1998.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. P. Tarr, H. Ossher, W. Harrison, and J. Stanley M. Sutton. N degrees of separation: multi-dimensional separation of concerns. In ICSE '99: Proceedings of the 21st international conference on Software engineering, pages 107--119, Los Alamitos, CA, USA, 1999. IEEE Computer Society Press.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. K. K. Thorup and M. Torgersen. Unifying genericity: Combining the benefits of virtual types and parameterized classes. In R. Guerraoui, editor, Proceedings ECOOP '99, volume 1628 of LNCS, pages 186--204, Lisbon, Portugal, June 1999. Springer-Verlag.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. M. Torgersen. Virtual types are statically safe. In International Workshop on Foundations of Object-Oriented Languages (FOOL), informal proceedings, Jan. 1998.]]Google ScholarGoogle Scholar
  33. A. Warth and T. Millstein. Featherweight eJava. Technical Report CSD-TR-060013, UCLA Computer Science Department, 2006. ftp://ftp.cs.ucla.edu/tech-report/2006-reports/060013.pdf.]]Google ScholarGoogle Scholar
  34. A. K. Wright and M. Felleisen. A syntactic approach to type soundness. Information and Computation, 115(1):38--94, Nov. 1994.]] Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Statically scoped object adaptation with expanders

      Recommendations

      Comments

      Login options

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

      Sign in

      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!