Common Algorithmic Patterns
version 1.0
Mark Kampe
$Id: algopatterns.html 85 2007-10-05 03:18:21Z Mark $
There are a great many popular design patterns.
The list below includes a few of the most fundamental
and popular patterns for implementing common operations.
Note that while these are described for object oriented languages,
most of these patterns can be used in any language.
Remember, program into your language,
not in it.
Object Abstraction Patterns
-
Iterator
A general interface to enumerating ordered lists,
independently of their implementation.
-
Visitor
A means for causing client-supplied methods to
be invoked on every element of a composite object ... making
it possible to dynamically extend existing types with new methods.
-
Command
A means of representing operations as objects that
can be instantiated, structured, enumerated and
otherwise manipulated as data.
-
Interpreter
Creating a specialized language (typically very simple
and with exactly the desired semantics) for expressing
desired computations.
Flow Control Patterns
-
Active Object
Asynchronous invocation of object methods in
schedulable parallel threads.
-
Observer
A Publish-Subscribe (pub/sub) event handling model where
readers and writers exchange information without being
aware of one-another. An observer registers a call-back
function to be called when a specified event happens.
-
Chain of Responsibility
A command execution model, where a sequence of processing functions
is given the opportunity to handle a request, until one of them
claims and handles it. An easy way to support the dynamic
addition of support for new (or sub-)commands.
-
Pipes and Filters
Constructing a desired transformation as a composition of
a sequence of smaller (independent) transformations.
Concurrency Patterns
-
Monitor
A class-based approach to the serilialization of object
method invocations.