Design Patterns in Dynamic Programming

Outline

(1) What Are Design Patterns?

What Are Design Patterns?

What’s in a Pattern?

Pattern: Abstract Factory

Level of Implementation of a Pattern

Sources on Design Patterns

(2) Design Patterns in Dynamic Languages

Design Patterns in Dylan or Lisp

First-Class Dynamic Types

Dynamic Pattern: Abstract Factory

Pattern: Abstract Factory

First-Class Dynamic Functions

Pattern: Strategy

Dynamic Pattern: Strategy

Macros

Pattern: Interpreter

Pattern: Interpreter with Macros

Method Combination

Pattern: Observer

Observer with Method Combination

The Type/Operation Matrix

Multimethods

Pattern: Builder

Pattern: Builder

Pattern: Builder with Multimethods

Modules

Pattern: Facade

Other Invisible Patterns

(3) New Dynamic Language Patterns

First-Class Design Patterns

First Class Pattern: Subroutine

First Class Pattern Implementation

Pattern: Protocol Method

Pattern: Protocol Method

A Study in Patterns: Iterator

C++ Pattern: Internal Iterator

Smalltalk Pattern: Internal Iterator

Dylan Pattern: Iteration Protocol

Dylan Pattern: Iteration Protocol

Dylan: Iteration Protocol Algebra

Pattern: Lazy Mapper Iteration

Sather Pattern: Coroutine Iterator

Pattern: Coroutine

Pattern: Control Abstraction

Pattern: New Control Abstraction

Pattern: Memoization

Pattern: Singleton as Memoization

Pattern: Compiler

Pattern: Run-Time Loading

Pattern: Partial Evaluation

Pattern: Partial Evaluation

Pattern: Rule-Based Translator

Pattern: Relation

(4) Design Strategies

What to Build

How to Build

How to Build: Abstraction

How to Write: Literate Programming

Class-Oriented or Class-Obsessed?

Strategy: Open Implementation

Design Strategy: English Translation

Design Strategy: English Translation

Design Strategy: English Translation

Metaphor: Agent Programming

Agent Programming Technology

Design for a Rational Agent

Rational Reasoning

The Three Laws of Robotics

Object-Oriented Programming

Agent Programming

Combining Agent Components

Real-Time Resource Allocation

Compilation of Anytime Algorithms

Technology for Multi-Agent Systems