Advertisement

The Expression Problem Revisited

Four New Solutions Using Generics
  • Mads Torgersen
Part of the Lecture Notes in Computer Science book series (LNCS, volume 3086)

Abstract

The expression problem (aka the extensibility problem) refers to a fundamental dilemma of programming: To which degree can your application be structured in such a way that both the data model and the set of virtual operations over it can be extended without the need to modify existing code, without the need for code repetition and without runtime type errors.

Over the years, many approaches to this problem have been proposed, each having different characteristics of type safety and reusability. While many of these rely on exotic or problem specific language extensions, this paper investigates the solution space within the framework of the soon-to-be mainstream generic extensions of C# and the Java programming language.

Four new solutions are presented which, though quite different, all rely on techniques that can be used in everyday programming.

Keywords

Data Class Java Programming Language Type Safety Expression Problem Client Code 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    Gamma, E., Helm, R., Johnson, R., Vlissides, J.: Design Patterns: Abstraction and Reuse of Object-Oriented Designs. Addison-Wesley, Reading (1994)Google Scholar
  2. 2.
    Gosling, J., Joy, B., Steele, G., Bracha, G.: The Java Language Specification, 3rd edn. Addison-Wesley, Reading (2004)Google Scholar
  3. 3.
    Bracha, G., Odersky, M., Stoutamire, D., Wadler, P.: Making the future safe for the past: Adding genericity to the java programming language. [20]Google Scholar
  4. 4.
  5. 5.
    Kennedy, A., Syme, D.: Design and implementation of generics for the.NET common language runtime. In: Norris, C., Fenwick, J.J.B. (eds.) Proceedings of the ACM SIGPLAN ’01 Conference on Programming Language Design and Implementation (PLDI 2001). ACM SIGPLAN Notices, vol. 36.5, pp. 1–12. ACM Press, New York (2001)CrossRefGoogle Scholar
  6. 6.
    Reynolds, J.C.: User-defined types and procedural data as complementary approaches to data abstraction. In: Schuman, S.A. (ed.) New Directions in Algorthmic Languages. INRIA (1975); Reprinted in D. Gries, ed, Programming Methodology, Springer-Verlag, 1978 and in C. A. Gunter and J. C. Mitchell, eds, Theoretical Aspects of Object-Oriented Programmig, MIT Press (1994)Google Scholar
  7. 7.
    Cook, W.R.: Object-oriented programming versus abstract data types. In: de Bakker, J.W., Rozenberg, G., de Roever, W.-P. (eds.) REX 1990. LNCS, vol. 489, Springer, Heidelberg (1991)CrossRefGoogle Scholar
  8. 8.
    Wadler, P.: The expression problem. Posted on the Java Genericity mailing list (1998)Google Scholar
  9. 9.
    Bruce, K.B.: Some challenging typing issues in object-oriented languages. In: Bono, V., Bugliesi, M. (eds.) Electronic Notes in Theoretical Computer Science, vol. 82, Elsevier, Amsterdam (2003)Google Scholar
  10. 10.
    Zenger, M., Odersky, M.: Extensible algebraic datatypes with defaults. In: Proceedings of the International Conference on Functional Programming (2001)Google Scholar
  11. 11.
    Cartwright, R., Steele, G.L.: Compatible genericity with runtime-types for the Java programming language. [20]Google Scholar
  12. 12.
    Myers, A., Bank, J., Liskov, B.: Parameterized types for Java. In: Jones, N.D. (ed.) Conf. Proceedings of the 24th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL), Paris, France, ACM Press, New York (1997)Google Scholar
  13. 13.
    Bracha, G., Cook, W.: Mixin-based inheritance. In: Meyrowitz, N.K. (ed.) Object Oriented Programming: Systems, Languages and Applications/European Conference on Object-Oriented Programming, Ottawa, Canada, OOPSLA/ECOOP 1990, pp. 303–311. ACM Press, New York (1990)CrossRefGoogle Scholar
  14. 14.
    Flatt, M., Krishnamurthi, S., Felleisen, M.: Classes and mixins. In: MacQueen, D. (ed.) Principles of Programming Languages (POPL 1998), San Diego, California, pp. 171–183. ACM Press, New York (1998)Google Scholar
  15. 15.
    Krishnamurthi, S., Felleisen, M., Friedman, D.P.: Synthesizing object-oriented and functional design to promote re-use. In: Jul, E. (ed.) ECOOP 1998. LNCS, vol. 1445, pp. 91–113. Springer, Heidelberg (1998)CrossRefGoogle Scholar
  16. 16.
    Canning, P., Cook, W., Hill, W., Olthoff, W., Mitchell, J.: F-bounded polymorphism for object-oriented programming. In: ACM Conference on Functional Programming and Computer Architecture, pp. 273–280. ACM Press, New York (1990)Google Scholar
  17. 17.
    Torgersen, M., Hansen, C.P., Ernst, E., von der Ahé, P., Bracha, G., Gafter, N.: Adding wildcards to the java programming language. In: Proceedings of the ACM Symposium of Applied Computing (2004)Google Scholar
  18. 18.
    Bobrow, D.G., DeMichiel, L.G., Gabriel, R.P., Keene, S.E., Kiczales, G., Moon, D.A.: Common lisp object system specification. ACM Sigplan Notices, special issue 23 (1988)Google Scholar
  19. 19.
    Castagna, G.: Covariance and contravariance: Conflict without a cause. ACM Transactions on Programming Languages and Systems 17, 431–447 (1995)CrossRefGoogle Scholar
  20. 20.
    Chambers, C. (ed.): Object Oriented Programming: Systems, Languages and Applications, Vancouver, BC. ACM Press, New York (1998)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2004

Authors and Affiliations

  • Mads Torgersen
    • 1
  1. 1.Computer Science DepartmentUniversity of AarhusAarhusDenmark

Personalised recommendations