Abstract
Many problems require recursively specified types of data and a collection of tools that operate on those data. Over time, these problems evolve so that the programmer must extend the toolkit or extend the types and adjust the existing tools accordingly. Ideally, this should be done without modifying existing code. Unfortunately, the prevailing program design strategies do not support both forms of extensibility: functional programming accommodates the addition of tools, while object-oriented programming supports either adding new tools or extending the data set, but not both. In this paper, we present a composite design pattern that synthesizes the best of both approaches and in the process resolves the tension between the two design strategies. We also show how this protocol suggests a new set of linguistic facilities for languages that support class systems.
This research was partially supported by NSF grants CCR-9619756, CCR-9633109, CCR-9708957 and CDA-9713032, and a Texas ATP grant.
Preview
Unable to display preview. Download preview PDF.
References
Baumgartner, G., K. Läufer and V. F. Russo. On the interaction of object-oriented design patterns and programming languages. Technical Report CSD-TR-96-020, Purdue University, Feburary 1996.
Cartwright, R. S. and M. Felleisen. Extensible denotational language specifications. In Hagiya, M. and J. C. Mitchell, editors, Symposium on Theoretical Aspects of Computer Science, pages 244–272. Springer-Verlag, April 1994. LNCS 789.
Clinger, W. and J. Rees. The revised4 report on the algorithmic language Scheme. ACM Lisp Pointers, 4(3), July 1991.
Cook, W. R. Object-oriented programming versus abstract data types. In Foundations of Object-Oriented Languages, pages 151–178, June 1990.
Coplien, J. O. and D. C. Schmidt, editors. Pattern Languages of Program Design. Addison-Wesley, Reading, MA, 1995.
Duggan, D. and C. Sourelis. Mixin modules. In ACM SIGPLAN International Conference on Functional Programming, pages 262–273, May 1996.
Eifrig, J., S. Smith and V. Trifonov. Type inference for recursively constrained types and its application to OOP. Mathematical Foundations of Program Semantics, 1995.
Espinosa, D. Building interpreters by transforming stratified monads. Unpublished manuscript, June 1994.
Felleisen, M. and D. P. Friedman. A Little Java, A Few Patterns. MIT Press, 1998.
Findler, R. B. Modular abstract interpreters. Unpublished manuscript, Carnegie Mellon University, June 1995.
Findler, R. B., C. Flanagan, M. Flatt, S. Krishnamurthi and M. Felleisen. DrScheme: A pedagogic programming environment for Scheme. In Ninth International Symposium on Programming Languages, Implementations, Logics, and Programs, 1997.
Flatt, M. PLT MzScheme: Language manual. Technical Report TR97-280, Rice University, 1997.
Gamma, E., R. Helm, R. Johnson and J. Vlissides. Design Patterns: Elements of Reusable Object-Oriented Software. Addison-Wesley Personal Computing Series. Addison-Wesley, Reading, MA, 1995.
Gosling, J., B. Joy and G. L. Steele, Jr. The Java Language Specification. Addison-Wesley, 1996.
Hudak, P. and M. P. Jones. Haskell vs. Ada vs. C++ vs. Awk vs... An experiment in software prototyping productivity. Research Report YALEU/DCS/RR-1049, Department of Computer Science, Yale University, New Haven, CT, USA, October 1994.
Hudak, P., S. Peyton Jones and P. Wadler. Report on the programming language Haskell: a non-strict, purely functional language. ACM SIGPLAN Notices, 27(5), May 1992. Version 1.2.
Kernighan, B. W. and D. M. Ritchie. The C Programming Language. Prentice Hall, 1988.
Kühne, T. The translator pattern—external functionality with homomorphic mappings. In Proceedings of TOOLS 23, USA, pages 48–62, July 1997.
Liang, S., P. Hudak and M. Jones. Monad transformers and modular interpreters. In Symposium on Principles of Programming Languages, pages 333–343, 1992.
Milner, R., M. Tofte and R. Harper. The Definition of Standard ML. MIT Press, Cambridge, MA, 1990.
Odersky, M. and P. Wadler. Pizza into Java: Translating theory into practice. In Symposium on Principles of Programming Languages, pages 146–159, Janurary 1997.
Palsberg, J. Efficient inference of object types. Information & Computation, 123(2):198–209, 1995.
Palsberg, J. and C. B. Jay. The essence of the Visitor pattern. Technical Report 05, University of Technology, Sydney, 1997.
Palsberg, J., C. Xiao and K. Lieberherr. Efficient implementation of adaptive software. ACM Transactions on Programming Languages and Systems, 17(2):264–292, 1995.
Portner, N. Flexible command interpreter: A pattern for an extensible and language-independent interpreter system, 1995. Appears in [5].
Rémy, D. Introduction aux objets. Unpublished manuscript, lecture notes for course de magistère, Ecole Normale Supérieure, 1996.
Reynolds, J. C. User-defined types and procedural data structures as complementary approaches to data abstraction. In Schuman, S. A., editor, New Directions in Algorithmic Languages, pages 157–168. IFIP Working Group 2.1 on Algol, 1975.
Riehle, D. Composite design patterns. In ACM SIGPLAN Conference on Object-Oriented Programming Systems, Languages & Applications, pages 218–228, 1997.
Seiter, L. M., J. Palsberg and K. J. Lieberherr. Evolution of object behavior using context relations. IEEE Transactions on Software Engineering, 1998.
Steele, G. L., Jr. Building interpreters by composing monads. In Symposium on Principles of Programming Languages, pages 472–492, Janurary 1994.
Stroustrup, B. The C++ Programming Language. Addison-Wesley, 1991.
Sun Microsystems. Java core reflection. API and Specification, 1997.
Thorup, K. K. Genericity in Java with virtual types. In European Conference on Object-Oriented Programming, pages 444–471, 1997.
Author information
Authors and Affiliations
Editor information
Rights and permissions
Copyright information
© 1998 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Krishnamurthi, S., Felleisen, M., Friedman, D.P. (1998). Synthesizing object-oriented and functional design to promote re-use. In: Jul, E. (eds) ECOOP’98 — Object-Oriented Programming. ECOOP 1998. Lecture Notes in Computer Science, vol 1445. Springer, Berlin, Heidelberg. https://doi.org/10.1007/BFb0054088
Download citation
DOI: https://doi.org/10.1007/BFb0054088
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-64737-9
Online ISBN: 978-3-540-69064-1
eBook Packages: Springer Book Archive