Skip to main content

Design Patterns as Higher−Order Datatype−Generic Programs

Jeremy Gibbons

Abstract

The aim of this tutorial is to draw together ideas from the Design Patterns community (the Gang of Four: Gamma, Helm, Johnson, Vlissides) and the Functional Programming world (eg Bird, Meertens, Hughes). In particular, the thesis is that whereas design patterns must be expressed extra-linguistically (as prose, diagrams, examples) in object-oriented languages, they may be captured directly as abstractions using higher-order operators in functional programming languages. Therefore, they may be reasoned about, type-checked, applied and reused, just as any other abstractions may be. We argue this case by developing the idea of higher-order operators, specifically for capturing patterns of computation in programs. We then bring this around to show how the intentions behind a number of the Gang of Four patterns—such as Composite, Visitor, Iterator, and Builder—have higher-order operators as their analogues in functional languages.

Address
Glasgow
Book Title
European Conference on Object−Oriented Programming
Month
jul
Note
Later version appears as Gibbons2005:DesignOOPSLA
Year
2005