The GOF Design Patterns in a Dynamic OO Language

The Design Patterns book by Gamma, Helm, Johnson, and Vlissides presents 23 time-tested patterns that consistently appear in well-designed software systems. Each pattern is presented with a description of the design problem the pattern addresses, as well as sample implementation code and design considerations. This paper explores how the patterns from the "Gang of Four", or "GOF" book, as it is often called, appear when similar problems are addressed using a dynamic, higher-order, object-oriented programming language. Some of the patterns disappear -- that is, they are supported directly by language features, some patterns are simpler or have a different focus, and some are essentially unchanged.

The paper is available as AI Memo AIM-2002-005, in Postscript, or PDF.

The slides for a lecture covering this material can be found at here (HTML).
They are also available in PDF (2.8 MB) and in Powerpoint (200 KB) formats.

GLOS - Greg's Little Object System

GLOS is a library of Scheme functions and macros that adds two primary bits of functionality to Scheme:
  1. Types: <top>, <bottom>, (and? t1 t2 ...), (or? t1 t2 ...), (== val), predicates (boolean-returning functions), and record subtypes.
  2. Dynamic Dispatch: When a generic function is called, it selects the most applicable method based on matching the types of the arguments against the specializers of each method. This is multiple dispatch, as opposed to the single dispatch of C++, Java, Smalltalk, etc. GLOS also supports method combination (before, after, and around) methods.

Currently the code is specific to Scheme48 (see www.s48.org), but only very slightly so. Ports welcome.

GLOS, as a tar file, as of Feb. 14, 2001. The tarball includes the paper described above, in postscript and PDF versions.

To load GLOS, fire up scheme48, open the file test.scm, and paste the first five lines from test.scm at the scheme48 prompt.


Greg Sullivan gregs@ai.mit.edu
Artificial Intelligence Laboratory
Massachusetts Institute of Technology
545 Technology Square NE43-802
Cambridge, MA 02139
(617)253-5807 (voice, office)