Design Patterns as Higher-Order Datatype-Generic Programs
Design patterns are reusable abstractions in object-oriented software. However, using current mainstream programming languages, these elements can only be expressed extra-linguistically: as prose, pictures, and prototypes. We believe that this is not inherent in the patterns themselves, but evidence of a lack of expressivity in the languages of today. We expect that, in the languages of the future, the code parts of design patterns will be expressible as reusable library components. Indeed, we claim that the languages of tomorrow will suffice; the future is not far away. All that is needed, in addition to commonly-available features, are higherorder and datatype-generic constructs; these features are already or nearly available now. We argue the case by presenting higherorder datatype-generic programs capturing ORIGAMI, a small suite of patterns for recursive data structures.
1. Introduction
Design patterns, as the subtitle of the seminal book [11] has it, are ‘elements of reusable object-oriented software’. However, within the confines of existing mainstream programming languages, these supposedly reusable elements can only be expressed extra-linguistically: as prose, pictures, and prototypes. We believe that this is not inherent in the patterns themselves, but evidence of a lack of expressivity in the languages of today. We expect that, in the languages of the future, the code parts of design patterns will be expressible as directly-reusable library components. The benefits will be considerable: patterns may then be reasoned about, typechecked, applied and reused, just as any other abstractions can.
Indeed, we claim that the languages of tomorrow will suffice;
the future is not far away. All that is needed, in addition
Copyright is held by the author/owner(s).
WGP’06 September 16, 2006, Portland, Oregon, USA.
ACM 1-59593-492-6/06/0009.
to what is provided by essentially every programming language,
are higher-order (parametrization by code) and datatype-generic
(parametrization by type constructor) features. Higher-order constructs
have been available for decades in functional programming
languages such as ML [37] and Haskell [42]. Datatype genericity
can be simulated in existing programming languages [7, 24, 39],
but we already have significant experience with robust prototypes
of languages that support it natively [25, 33].Indeed, we claim that the languages of tomorrow will suffice; the future is not far away. All that is needed, in addition to what is provided by essentially every programming language, are higher-order (parametrization by code) and datatype-generic (parametrization by type constructor) features. Higher-order constructs have been available for decades in functional programming languages such as ML [37] and Haskell [42]. Datatype genericity can be simulated in existing programming languages [7, 24, 39], but we already have significant experience with robust prototypes of languages that support it natively [25, 33].
…
Website: www.comlab.ox.ac.uk | Filesize: 136kb
No of Page(s): 12
Click here to download Design Patterns as Higher-Order Datatype-Generic Programs.
Related Tutorial
Tags: design pattern
Comments
Leave a Reply




