Design Patterns
This page is gathered and maintained by John Curley

Design patterns provide proven solutions to common challenges found when developing software. The concept of design patterns originated in the field of architecture and, more specifically, from the architect Christopher Alexander in the 1970s. Design patterns have since been adapted to and adopted by the software industry.

The Patterns Home Page is a great resource for information about design patterns.

The following is a comprehensive list (and links) of design patterns found in the Design Patterns, Pattern-Oriented Software Architecture (Volumes I and II), and J2EE Design Patterns from Sun Microsystems.

Design Pattern Description
abstract factory a hierarchy that is used to create different but related objects. A concrete factory is passed to a client who invokes the appropriate method on the factory, leaving it the responsibility of creating the appropriate object.
acceptor-connector establishes connections among peer services in a networked system. Decouples the connection and initialization of peer services from the processing they perform. An acceptor listens for connection requests and a connector actively makes connections. The Unix Inetd superserver makes use of an acceptor process.
active object decouples a method invocation from its execution. Enhances concurrency and simplifies synchronization access. Uses a proxy to create the method request, a scheduler to schedule and run the method request, and an activation list to store all requested methods that are pending. In this design, priorities can be assigned various methods.
adapter similar to a wrapper. Adapts an interface to an interface that the client expects; this can be achieved through composition or inheritance. An object adapter will wrap an object to provide the appropriate interface: this minimizes the need for subclassing.
aggregate entity models, represents, and manages a set of interrelated persistent objects rather than representing them as individual fine-grained entity beans. A Composite Entity bean represents a graph of these objects. A composite entity can be implemented as a coarse-grained entity bean that contains fine-grained dependent objects. This pattern can make use of such strategies as lazy loading or store optimization (marking individual fields as modified).
asynchronous completion token efficiently passes information that needs to be shared between client and server. Allows an application to efficiently demultiplex and process the responses of asynchronous operations invoked on services. Also known as a cookie.
bridge decouples an abstraction from an implementation so that the two can vary independently.
broker mechanism in which to perform remote service calls. The broker registers various servers and provides lookup services for clients. Abstracts server location from client (achieving location transparency) and allows a system to add, delete, or move components at run-time.
builder separates the construction of a complex object from its representation so that the same construction process can create different representations. Similar to abstract factory but object is built in steps determined by the director (client).
business delegate provides a layer between clients and session beans to decouple these objects. This lessens the impact of session bean changes on the client and avoids exposing clients to service level exceptions. Business delegates can lookup business services (often using a service locator) and cache data for the presentation tier.
chain of responsibility a pattern that strings a series of objects together through indirection pointer (pointer/reference) to allow an object to handle a request or pass it to the next object in the chain.
client-dispatcher-server decouples clients and servers by supporting location transparency. Servers can be changed or added without source code modification to the dispatcher. Also abstracts the details of the communication established between client and server.
command encapsulates a command in an object. Used to dynamically change behavior.
command processor separates the request for a service from its execution. The command processor works in conjunction with the command pattern to schedule and carry out requests.
component configurator allows an application to link and unlink its component implementations (such as DLLs or Unix shared libraries) without having to modify, recompile, or statically relink the application. It makes use of a component configurator that has the responisbility of linking and unlinking a shared library in to an application. Web browsers use this pattern to start, run and stop Java applets.
composite complex object that contains other objects that are often part of the same class hierarchy.
composite views composed of multiple atomic subviews. Each component of the template may be included dynamically into the whole and layout of the page may be managed independently of the content. This also allows for the reuse of content retrieval among different views.
data access object pattern that allows access to different types of data sources (RDBMS, OODBMS, flat files, etc.) using one class hierarchy. Decouples database access from classes that otherwise perform unrelated duties.
decorating filter modifies and audits certain types of requests before passing them on to their associated handler.
decorator  adds additional functionality to an object dynamically. Encapsulates an object of an applicable class hierarchy to achieve this behavior.
delegate surrogate object that stands in for another object. Acts as an intermediary layer. Has qualities of both proxies and facades.
dispatcher view combines a controller and dispatcher to handle client requests and prepare a dynamic presentation as the response. Centralizes control and improves reuse and maintainability. Though this design is similar in structure to the service to worker pattern, it differs in that the controller and dispatcher typically have limited responsibilities.
extension interface  provides interfaces that components implement. If new functionality is needed, the existing interfaces are left intact and new interfaces are created. This prevents the breaking of client code when developers extend/modify the functionality of a component, therefore this pattern is useful when a component interface will be modified regularly over time. Microsoft COM and its approach to writing components is an example of this design pattern.
facade an object that simplifies complex operations and abstracts them from the client. 
factory method method that is responsible for creating an object. This method can be overridden in a hierarchy to customize desired object creation.
fast lane reader An efficient way to access tabular, read-only data. A fast lane reader component directly accesses persistent data using JDBC components, instead of using entity beans.
flyweight shares large numbers of fine-grained objects in an efficient manner. The client passes in the context in which the flyweight is being used via method calls so the same flyweight can be used in many different scenarios. One example where this pattern would be used is a word document application where each ASCII character could be encapsulated in a flyweight and kept in memory to be shared by multiple documents.
forwarder-receiver provides transparent inter-process communication for software systems with peer-to-peer connections. It uses peers and their forwarders and receivers to send and receive messages.
front controller provides a centralized place to handle system services and business logic across multiple requests. A controller manages business logic processing and request handling.
half-sync/half-async an event dispatching mechanism that handles synchronous messaging (client must wait for server to finish) on one side and asynchronous messaging (client can continue its processing without waiting for server to finish) on the other. A queueing layer acts as a mediator between the synchrounous layer and asynchronous layer. Allows for increased performance along with easier development.
interceptor a component that is registered to handle requests forwarded by a dispatcher. This allows services to be added to a framework dynamically.
iterator a design that separates the ability to traverse a collection with its internal structure.
layers segmenting a system in to tiers, each tier performing a related set of functionality. Often referrred to as n-tier.
leader/followers allows a thread pool to efficiently process service requests that originate from event sources. A thread in a thread pool, the leader, waits to handle a service request while other threads, the followers, sleep. Once the request is received the leader appoints one of the follower threads as the new leader and goes on to demultiplex and dispatch the request.
mediator allows for loose coupling between objects. Objects refer to a mediator instead of each other. The mediator is a centralized communication component that allows developers to vary interaction between these objects.
memento design that preserves an object's state. This can be used to restore an original state if the current state is rolled back.
microkernel a pattern that places the core functionality of a system in a kernel and then places other functionality in additional components. Operating systems use this design (the core kernel is placed in some executable process and then additional functionality, such as device drivers, is placed in a component such as a shared library DLL).
monitor object synchronizes concurrent method execution to ensure that only one method runs at a time. Uses conditions to achieve this. Similar to active object, though easier to implement and less sophisticated.
model 2 servlet controller a J2EE pattern that provides one centralized request handling servlet that dispatches requests to the appropriate handler object.
model-view-controller common approach to breaking up functionality. The model is the data and corresponding logic, the view is the UI and the controller dispatches data between the model and the view. This design provides a great deal of flexibility where many different represtentations of the same data can be displayed.
observer a notification pattern. The subject keeps a registered list of observers that it invokes callbacks on when an event occurs.
pipes and filters a series of data transforming processes (filters) connected together by streaming processes (pipes). An example of this would be a series of operations on the Unix command line (ex.: ls -l | cut -c 55- > data.txt)
proactor Asynchronous version of the reactor. Demultiplexes and dispatches service requests triggered by the completion of asynchronous operations.
prototype creates objects using a prototypical instance, that is copied to create new objects. This design pattern can be used when the classes to be instantiated are specified at run-time (dynamic loading) and/or to avoid building a large class hierarchy that parallels a related products class hierarchy.
proxy an object that represents another object, often substituting a lightweight object for a heavyweight object to improve efficiency. Types of proxies: (1) remote proxy, which is responsible for encoding a request and its arguments and for sending the encoded request to the real object in a different address space, (2) virtual proxy, caches additional information about the real object to further limit its access, (3) protection proxy checks that the caller has the access permissions required to perform the request, and (4) smart reference, which handles functionality such as reference counting and synchronization locking.
publisher-subscriber based on the observer pattern. Publishers notify subscribers about data changes. The push version sends the changed data along with the notification; the pull version just notifies the subscriber and provides it the flexibility to request the data if it wants it.
reactor allows event-driven applications to demultiplex and dispatch service requests that are delivered to an application from one or more clients. Decouples the event dispatcher from application services.
reflection pattern that allows a client to view an object's metadata.
service activator allows EJBs and other business services to receive asynchronous requests. A service activator is implemented as a JMS Listener and waits on a queue or topic to dispatch the request.
service locator performs service lookup and creation. Abstracts the API lookup (naming) services, vendor dependencies, lookup complexities and business object creation to provide a simple interface to clients.
singleton ensures that only one instance of an object exists.
service to worker combination of a controller and dispatcher that also makes use of views and helpers. Controllers delegate content retrieval to helpers, which manage the population of the intermediate model for the view. Centralizes control and improves modularity and reuse. Controllers are the entry point that handles the request, while dispatchers are responsible for view management and navigation.
session facade provides centralized communication between clients and entity beans. Removes dependencies amongs entity beans, thus minimizing overhead.
state similar to the strategy pattern. A class contains a concrete class of a state hierarchy to represent the state of the object. The object can appear to change its state by changing the state class it contains.
strategy a hierarchy that implements varying behavior. A container object can contain different subclasses of an abstract class to obtain desired behavior.
template method a method found in an abstract class that calls virtual methods to be overridden in subclasses. This pattern is used to provide a basic structure for an operation but to allow derived classes to vary its behavior.
thread-safe interface places synchronization locks at the public interface level, allowing internal methods to trust that the locking mechanisms are already in place. Ensures that intra-component method calls do not incur deadlock. The strategized locking pattern should make use of this pattern.
thread-specific storage provides a copy of logically global objects to threads to reduce locking overhead.
value list handler controls the search and caches the results to provide the client the required data. Provides an alternative to EJB Finders for large queries.
value object encapsulates business data and allows clients to receive required data with one remote method call. A value object is a coarse grained object and can be a super class or a contained member. Improves efficiency. If the value object and its corresponding business entity (entity bean) have a one-to-one mapping in relation to its data members, use inheritance to eliminate code duplication.
value object assembler gathers data from multiple locations and assembles this data in to a value object to pass back to the client. Improves network perfomance and decouples the client from the data model. Used for complex data models and, therefore, the value object that is assembled should usually be read-only.
view handler manages all views that a software system provides. Coordinates dependencies between views and organizes their update. Microsoft MFC makes use of this pattern: notifying all views when shared data is modified and allowing for concurrent update.
view helper separates business logic from presentation logic. Helper classes and tag libraries remove scriptlets from jsp classes allowing for reuse and clearer boundaries of code. The helper classes/tag libraries have the responsibility of performing the business logic and formatting of content retrieval for display, leaving presentation to the jsp. This is also useful in that the markup language is left for the web developer (who is responsible for the jsp) while more complex processing logic is left for the engineer (who is responsible for the helper classes and the tag libraries).
visitor encapsulates an operation that is performed on other classes. This allows for the creation of new operations without changing the classes on which the operation will operate. The visitor object is passed in to the methods of the classes it performs operations on.
wrapper a container that provides an interface to the contained object. This interface is suited to the wrapper's clients.
wrapper facade a combination of the wrapper and the facade design patterns. Encapsulates non-object-oriented functions and data structures in a cohesive object-oriented abstraction. MFC provides a set of wrapper facades to encapsulate its lower level C Win32 APIs.