Design pattern (computer science)
Encyclopedia
In software engineering
Software engineering
Software Engineering is the application of a systematic, disciplined, quantifiable approach to the development, operation, and maintenance of software, and the study of these approaches; that is, the application of engineering to software...

, a design pattern
Pattern
A pattern, from the French patron, is a type of theme of recurring events or objects, sometimes referred to as elements of a set of objects.These elements repeat in a predictable manner...

is a general reusable solution to a commonly occurring problem within a given context in software design
Software design
Software design is a process of problem solving and planning for a software solution. After the purpose and specifications of software are determined, software developers will design or employ designers to develop a plan for a solution...

. A design pattern is not a finished design that can be transformed directly into code. It is a description or template for how to solve a problem that can be used in many different situations. Object-oriented design patterns typically show relationships and interaction
Interaction
Interaction is a kind of action that occurs as two or more objects have an effect upon one another. The idea of a two-way effect is essential in the concept of interaction, as opposed to a one-way causal effect...

s between class
Class (computer science)
In object-oriented programming, a class is a construct that is used as a blueprint to create instances of itself – referred to as class instances, class objects, instance objects or simply objects. A class defines constituent members which enable these class instances to have state and behavior...

es or object
Object (computer science)
In computer science, an object is any entity that can be manipulated by the commands of a programming language, such as a value, variable, function, or data structure...

s, without specifying the final application classes or objects that are involved. Many patterns imply object-orientation
Object-oriented programming
Object-oriented programming is a programming paradigm using "objects" – data structures consisting of data fields and methods together with their interactions – to design applications and computer programs. Programming techniques may include features such as data abstraction,...

 or more generally mutable state, and so may not be as applicable in functional programming
Functional programming
In computer science, functional programming is a programming paradigm that treats computation as the evaluation of mathematical functions and avoids state and mutable data. It emphasizes the application of functions, in contrast to the imperative programming style, which emphasizes changes in state...

 languages, in which data is immutable or treated as such.

Design patterns reside in the domain of modules and interconnections. At a higher level there are architectural patterns
Architectural pattern (computer science)
An architectural pattern in software is a standard design in the field of software architecture. The concept of a software architectural pattern has a broader scope than the concept of a software design pattern...

 that are larger in scope, usually describing an overall pattern followed by an entire system.

There are many types of design patterns, like
  • Algorithm strategy patterns addressing concerns related to high-level strategies describing how to exploit application characteristic on a computing platform.
  • Computational design patterns addressing concerns related to key computation identification.
  • Execution patterns that address concerns related to supporting application execution, including strategies in executing streams of tasks and building blocks to support task synchronization.
  • Implementation strategy patterns addressing concerns related to implementing source code to support
    1. program organization, and
    2. the common data structures specific to parallel programming.
  • Structural design patterns addressing concerns related to high-level structures of applications being developed.

History

Patterns originated as an architectural concept by Christopher Alexander
Christopher Alexander
Christopher Wolfgang Alexander is a registered architect noted for his theories about design, and for more than 200 building projects in California, Japan, Mexico and around the world...

 (1977/79). In 1987, Kent Beck
Kent Beck
Kent Beck is an American software engineer and the creator of the Extreme Programming and Test Driven Development software development methodologies. Beck was one of the 17 original signatories of the Agile Manifesto in 2001....

 and Ward Cunningham
Ward Cunningham
Howard G. "Ward" Cunningham is an American computer programmer who developed the first wiki. A pioneer in both design patterns and Extreme Programming, he started programming the software WikiWikiWeb in 1994 and installed it on the website of his software consultancy, Cunningham & Cunningham , on...

 began experimenting with the idea of applying patterns to programming and presented their results at the OOPSLA
OOPSLA
OOPSLA is an annual ACM research conference. OOPSLA mainly takes place in the United States, while the sister conference of OOPSLA, ECOOP, is typically held in Europe...

 conference that year. In the following years, Beck, Cunningham and others followed up on this work.

Design patterns gained popularity in computer science
Computer science
Computer science or computing science is the study of the theoretical foundations of information and computation and of practical techniques for their implementation and application in computer systems...

 after the book Design Patterns: Elements of Reusable Object-Oriented Software was published in 1994 by the so-called "Gang of Four" (Gamma et al.). That same year, the first Pattern Languages of Programming
Pattern Languages of Programming
Pattern Languages of Programs is the name of a group of annual conferences. The purpose of these conferences is to develop and refine the art of software design patterns. Most of the effort focuses on developing a textual presentation of a pattern such that it becomes easy to understand and apply...

 Conference was held and the following year, the Portland Pattern Repository
Portland Pattern Repository
The Portland Pattern Repository is a repository for computer programming design patterns. It was accompanied by a companion website, WikiWikiWeb, which was the world's first wiki....

 was set up for documentation of design patterns. The scope of the term remains a matter of dispute. Notable books in the design pattern genre include:

Although design patterns have been applied practically for a long time, formalization of the concept of design patterns languished for several years.

In 2009 over 30 contributors collaborated with Thomas Erl
Thomas Erl
Thomas Erl is a Canadian author, and public speaker known as a major contributor in the fields of service-oriented architecture, service-orientation and cloud computing.- Biography :...

 on his book, SOA Design Patterns. The goal of this book was to establish a de facto catalog of design patterns for SOA
Service-oriented architecture
In software engineering, a Service-Oriented Architecture is a set of principles and methodologies for designing and developing software in the form of interoperable services. These services are well-defined business functionalities that are built as software components that can be reused for...

 and service-orientation
Service-orientation
Service-orientation is a design paradigm to build computer software in the form of services. Like other design paradigms , service-orientation provides a governing approach to automate business logic as distributed systems...

. (Over 200+ IT
Information technology
Information technology is the acquisition, processing, storage and dissemination of vocal, pictorial, textual and numerical information by a microelectronics-based combination of computing and telecommunications...

 professionals participated world-wide in reviewing Erl
Thomas Erl
Thomas Erl is a Canadian author, and public speaker known as a major contributor in the fields of service-oriented architecture, service-orientation and cloud computing.- Biography :...

's book and patterns.) These patterns are also published and discussed on the community research site soapatterns.org

Practice

Design patterns can speed up the development process by providing tested, proven development paradigms. Effective software design requires considering issues that may not become visible until later in the implementation. Reusing design patterns helps to prevent subtle issues that can cause major problems, and it also improves code readability for coders and architects who are familiar with the patterns.

In order to achieve flexibility, design patterns usually introduce additional levels of indirection
Indirection
In computer programming, indirection is the ability to reference something using a name, reference, or container instead of the value itself. The most common form of indirection is the act of manipulating a value through its memory address. For example, accessing a variable through the use of a...

, which in some cases may complicate the resulting designs and hurt application performance.

By definition, a pattern must be programmed anew into each application that uses it. Since some authors see this as a step backward from software reuse as provided by components, researchers have worked to turn patterns into components. Meyer and Arnout were able to provide full or partial componentization of two-thirds of the patterns they attempted.

Often, people only understand how to apply certain software design techniques to certain problems . These techniques are difficult to apply to a broader range of problems. Design patterns provide general solutions, documented
Documentation
Documentation is a term used in several different ways. Generally, documentation refers to the process of providing evidence.Modules of Documentation are Helpful...

 in a format that does not require specifics tied to a particular problem.

Structure

Design patterns are composed of several sections (see Documentation below). Of particular interest are the Structure, Participants, and Collaboration sections. These sections describe a design motif: a prototypical micro-architecture that developers copy and adapt to their particular designs to solve the recurrent problem described by the design pattern. A micro-architecture is a set of program constituents (e.g., classes, methods...) and their relationships. Developers use the design pattern by introducing in their designs this prototypical micro-architecture, which means that micro-architectures in their designs will have structure and organization similar to the chosen design motif.

In addition to this, patterns allow developers to communicate using well-known, well understood names for software interactions. Common design patterns can be improved over time, making them more robust than ad-hoc designs.

Domain-specific patterns

Efforts have also been made to codify design patterns in particular domains, including use of existing design patterns as well as domain specific design patterns. Examples include user interface
User interface
The user interface, in the industrial design field of human–machine interaction, is the space where interaction between humans and machines occurs. The goal of interaction between a human and a machine at the user interface is effective operation and control of the machine, and feedback from the...

 design patterns, information visualization
Information visualization
Information visualization is the interdisciplinary study of "the visual representation of large-scale collections of non-numerical information, such as files and lines of code in software systems, library and bibliographic databases, networks of relations on the internet, and so forth".- Overview...

, secure design, "secure usability", Web design and business model design.

The annual Pattern Languages of Programming
Pattern Languages of Programming
Pattern Languages of Programs is the name of a group of annual conferences. The purpose of these conferences is to develop and refine the art of software design patterns. Most of the effort focuses on developing a textual presentation of a pattern such that it becomes easy to understand and apply...

 Conference proceedings include many examples of domain specific patterns.

Classification and list

Design pattern
Design pattern
A design pattern in architecture and computer science is a formal way of documenting a solution to a design problem in a particular field of expertise. The idea was introduced by the architect Christopher Alexander in the field of architecture and has been adapted for various other disciplines,...

s were originally grouped into the categories: creational pattern
Creational pattern
In software engineering, creational design patterns are design patterns that deal with object creation mechanisms, trying to create objects in a manner suitable to the situation. The basic form of object creation could result in design problems or added complexity to the design. Creational design...

s, structural pattern
Structural pattern
In software engineering, structural design patterns are design patterns that ease the design by identifying a simple way to realize relationships between entities.Examples of Structural Patterns include:...

s, and behavioral pattern
Behavioral pattern
In software engineering, behavioral design patterns are design patterns that identify common communication patterns between objects and realize these patterns...

s, and described using the concepts of delegation
Delegation (programming)
In object-oriented programming, there are two related notions of delegation.* Most commonly, it refers to a programming language feature making use of the method lookup rules for dispatching so-called self-calls as defined by Lieberman in his 1986 paper "Using Prototypical Objects to Implement...

, aggregation, and consultation. For further background on object-oriented design, see coupling
Coupling (computer science)
In computer science, coupling or dependency is the degree to which each program module relies on each one of the other modules.Coupling is usually contrasted with cohesion. Low coupling often correlates with high cohesion, and vice versa...

 and cohesion
Cohesion (computer science)
In computer programming, cohesion is a measure of how strongly-related each piece of functionality expressed by the source code of a software module is...

, inheritance
Inheritance (computer science)
In object-oriented programming , inheritance is a way to reuse code of existing objects, establish a subtype from an existing object, or both, depending upon programming language support...

, interface
Interface (computer science)
In the field of computer science, an interface is a tool and concept that refers to a point of interaction between components, and is applicable at the level of both hardware and software...

, and polymorphism
Polymorphism in object-oriented programming
Subtype polymorphism, almost universally called just polymorphism in the context of object-oriented programming, is the ability to create a variable, a function, or an object that has more than one form. The word derives from the Greek "πολυμορφισμός" meaning "having multiple forms"...

. Another classification has also introduced the notion of architectural design pattern that may be applied at the architecture level of the software such as the Model–View–Controller pattern.
Name Description In Design Patterns In Code Complete
Code Complete
Code Complete is a software development book, written by Steve McConnell and published in 1993 by Microsoft Press, urging developers to get past code and fix programming and the "big design up front" waterfall model...

Other
Creational pattern
Creational pattern
In software engineering, creational design patterns are design patterns that deal with object creation mechanisms, trying to create objects in a manner suitable to the situation. The basic form of object creation could result in design problems or added complexity to the design. Creational design...

s
Abstract factory
Abstract factory pattern
The abstract factory pattern is a software design pattern that provides a way to encapsulate a group of individual factories that have a common theme. In normal usage, the client software creates a concrete implementation of the abstract factory and then uses the generic interfaces to create the...

Provide an interface for creating families of related or dependent objects without specifying their concrete classes.
Builder
Builder pattern
The builder pattern is an object creation software design pattern. The intention is to abstract steps of construction of objects so that different implementations of these steps can construct different representations of objects...

Separate the construction of a complex object from its representation allowing the same construction process to create various representations.
Factory method
Factory method pattern
The factory method pattern is an object-oriented design pattern to implement the concept of factories. Like other creational patterns, it deals with the problem of creating objects without specifying the exact class of object that will be created.The creation of an object often requires complex...

Define an interface for creating an object, but let subclasses decide which class to instantiate. Factory Method lets a class defer instantiation to subclasses (dependency injection
Dependency injection
Dependency injection is a design pattern in object-oriented computer programming whose purpose is to improve testability of, and simplify deployment of components in very large software systems....

).
Lazy initialization
Lazy initialization
In computer programming, lazy initialization is the tactic of delaying the creation of an object, the calculation of a value, or some other expensive process until the first time it is needed....

Tactic of delaying the creation of an object, the calculation of a value, or some other expensive process until the first time it is needed.
Multiton
Multiton pattern
In software engineering, the multiton pattern is a design pattern similar to the singleton, which allows only one instance of a class to be created. The multiton pattern expands on the singleton concept to manage a map of named instances as key-value pairs....

Ensure a class has only named instances, and provide global point of access to them.
Object pool Avoid expensive acquisition and release of resources by recycling objects that are no longer in use. Can be considered a generalisation of connection pool
Connection Pool
In software engineering,a connection pool is a cache of database connections maintained so that the connections can be reused when future requests to the database are required....

 and thread pool patterns.
Prototype
Prototype pattern
The prototype pattern is a creational design pattern used in software development when the type of objects to create is determined by a prototypical instance, which is cloned to produce new objects...

Specify the kinds of objects to create using a prototypical instance, and create new objects by copying this prototype.
Resource acquisition is initialization
Resource Acquisition Is Initialization
Resource Acquisition Is Initialization is a programming idiom used in several object-oriented languages like C++, D and Ada. The technique was invented by Bjarne Stroustrup to deal with resource deallocation in C++...

Ensure that resources are properly released by tying them to the lifespan of suitable objects.
Singleton
Singleton pattern
In software engineering, the singleton pattern is a design pattern used to implement the mathematical concept of a singleton, by restricting the instantiation of a class to one object. This is useful when exactly one object is needed to coordinate actions across the system...

Ensure a class has only one instance, and provide a global point of access to it.
Structural pattern
Structural pattern
In software engineering, structural design patterns are design patterns that ease the design by identifying a simple way to realize relationships between entities.Examples of Structural Patterns include:...

s
Adapter
Adapter pattern
In computer programming, the adapter pattern is a design pattern that translates one interface for a class into a compatible interface...

 or Wrapper
Convert the interface of a class into another interface clients expect. An adapter lets classes work together that could not otherwise because of incompatible interfaces.
Bridge
Bridge pattern
The bridge pattern is a design pattern used in software engineering which is meant to "decouple an abstraction from its implementation so that the two can vary independently"...

Decouple an abstraction from its implementation allowing the two to vary independently.
Composite
Composite pattern
In software engineering, the composite pattern is a partitioning design pattern. The composite pattern describes that a group of objects are to be treated in the same way as a single instance of an object. The intent of a composite is to "compose" objects into tree structures to represent...

Compose objects into tree structures to represent part-whole hierarchies. Composite lets clients treat individual objects and compositions of objects uniformly.
Decorator
Decorator pattern
In object-oriented programming, the decorator pattern is a design pattern that allows behaviour to be added to an existing object dynamically.-Introduction:...

Attach additional responsibilities to an object dynamically keeping the same interface. Decorators provide a flexible alternative to subclassing for extending functionality.
Facade
Façade pattern
The facade pattern is a software engineering design pattern commonly used with Object-oriented programming. The name is by analogy to an architectural facade....

Provide a unified interface to a set of interfaces in a subsystem. Facade defines a higher-level interface that makes the subsystem easier to use.
Front Controller
Front Controller pattern
The Front Controller Pattern is a software design pattern listed in several pattern catalogs. The pattern relates to the design of web applications. It "provides a centralized entry point for handling requests."...

The pattern relates to the design of web applications. It provides a centralized entry point for handling requests.
Flyweight
Flyweight pattern
Flyweight is a software design pattern. A flyweight is an object that minimizes memory use by sharing as much data as possible with other similar objects; it is a way to use objects in large numbers when a simple repeated representation would use an unacceptable amount of memory. The term is named...

Use sharing to support large numbers of fine-grained objects efficiently.
Proxy
Proxy pattern
In computer programming, the proxy pattern is a software design pattern.A proxy, in its most general form, is a class functioning as an interface to something else...

Provide a surrogate or placeholder for another object to control access to it.
Behavioral pattern
Behavioral pattern
In software engineering, behavioral design patterns are design patterns that identify common communication patterns between objects and realize these patterns...

s
Blackboard Generalized observer, which allows multiple readers and writers. Communicates information system-wide.
Chain of responsibility Avoid coupling the sender of a request to its receiver by giving more than one object a chance to handle the request. Chain the receiving objects and pass the request along the chain until an object handles it.
Command
Command pattern
In object-oriented programming, the command pattern is a design pattern in which an object is used to represent and encapsulate all the information needed to call a method at a later time...

Encapsulate a request as an object, thereby letting you parameterize clients with different requests, queue or log requests, and support undo
Undo
Undo is a command in many computer programs. It erases the last change done to the document reverting it to an older state. In some more advanced programs such as graphic processing, undo will negate the last command done to the file being edited....

able operations.
Interpreter
Interpreter pattern
In computer programming, the interpreter pattern is a design pattern. The interpreter pattern specifies how to evaluate sentences in a language. The basic idea is to have a class for each symbol in a specialized computer language...

Given a language, define a representation for its grammar along with an interpreter that uses the representation to interpret sentences in the language.
Iterator
Iterator pattern
In object-oriented programming, the iterator pattern is a design pattern in which an iterator is used to traverse a container and access the container's elements...

Provide a way to access the elements of an aggregate object sequentially without exposing its underlying representation.
Mediator
Mediator pattern
The mediator pattern, one of the 23 design patterns described in Design Patterns: Elements of Reusable Object-Oriented Software, provides a unified interface to a set of interfaces in a subsystem. This pattern is considered to be a behavioral pattern due to the way it can alter the program's...

Define an object that encapsulates how a set of objects interact. Mediator promotes loose coupling
Loose coupling
In computing and systems design a loosely coupled system is one where each of its components has, or makes use of, little or no knowledge of the definitions of other separate components. The notion was introduced into organizational studies by Karl Weick...

 by keeping objects from referring to each other explicitly, and it lets you vary their interaction independently.
Memento
Memento pattern
The memento pattern is a software design pattern that provides the ability to restore an object to its previous state .The memento pattern is implemented with two objects: the originator and a caretaker. The originator is some object that has an internal state. The caretaker is going to do...

Without violating encapsulation, capture and externalize an object's internal state allowing the object to be restored to this state later.
Null object
Null Object pattern
In object-oriented computer programming, a Null Object is an object with defined neutral behavior. The Null Object design pattern describes the uses of such objects and their behavior . It was first published in the Pattern Languages of Program Design book series.-Motivation:In most...

Avoid null references by providing a default object.
Observer
Observer pattern
The observer pattern is a software design pattern in which an object, called the subject, maintains a list of its dependents, called observers, and notifies them automatically of any state changes, usually by calling one of their methods...

 or Publish/subscribe
Publish/subscribe
Publish–subscribe is a messaging pattern where senders of messages, called publishers, do not program the messages to be sent directly to specific receivers, called subscribers. Published messages are characterized into classes, without knowledge of what, if any, subscribers there may be...

Define a one-to-many dependency between objects where a state change in one object results with all its dependents being notified and updated automatically.
Servant
Design pattern Servant
Servant is a design pattern used to offer some functionality to a group of classes without defining that functionality in each of them. A Servant is a class whose instance provides methods that take care of a desired service, while objects for which the servant does something, are taken as...

Define common functionality for a group of classes
Specification
Specification pattern
In computer programming, the specification pattern is a particular software design pattern, whereby business rules can be recombined by chaining the business rules together using boolean logic....

Recombinable business logic
Business logic
Business logic, or domain logic, is a non-technical term generally used to describe the functional algorithms that handle information exchange between a database and a user interface.- Scope of business logic :Business logic:...

 in a Boolean
Boolean algebra
In abstract algebra, a Boolean algebra or Boolean lattice is a complemented distributive lattice. This type of algebraic structure captures essential properties of both set operations and logic operations. A Boolean algebra can be seen as a generalization of a power set algebra or a field of sets...

 fashion
State
State pattern
The state pattern, which closely resembles Strategy Pattern, is a behavioral software design pattern, also known as the objects for states pattern. This pattern is used in computer programming to represent the state of an object. This is a clean way for an object to partially change its type at...

Allow an object to alter its behavior when its internal state changes. The object will appear to change its class.
Strategy
Strategy pattern
In computer programming, the strategy pattern is a particular software design pattern, whereby algorithms can be selected at runtime. Formally speaking, the strategy pattern defines a family of algorithms, encapsulates each one, and makes them interchangeable...

Define a family of algorithms, encapsulate each one, and make them interchangeable. Strategy lets the algorithm vary independently from clients that use it.
Template method
Template method pattern
In software engineering, the template method pattern is a design pattern.It is a behavioral pattern, and is unrelated to C++ templates.-Introduction:A template method defines the program skeleton of an algorithm...

Define the skeleton of an algorithm in an operation, deferring some steps to subclasses. Template method lets subclasses redefine certain steps of an algorithm without changing the algorithm's structure.
Visitor
Visitor pattern
In object-oriented programming and software engineering, the visitor design pattern is a way of separating an algorithm from an object structure on which it operates. A practical result of this separation is the ability to add new operations to existing object structures without modifying those...

Represent an operation to be performed on the elements of an object structure. Visitor lets you define a new operation without changing the classes of the elements on which it operates.

Name Description In POSA2 Other
Concurrency pattern
Concurrency pattern
In software engineering, concurrency patterns are those types of design patterns that deal with multi-threaded programming paradigm.Examples of this class of patterns include:* Active Object* Balking pattern* Double checked locking pattern...

s
Active Object
Active Object
The active object design pattern decouples method execution from method invocation that reside in their own thread of control. The goal is to introduce concurrency, by using asynchronous method invocation and a scheduler for handling requests....

Decouples method execution from method invocation that reside in their own thread of control. The goal is to introduce concurrency, by using asynchronous method invocation
Asynchronous method invocation
In object-oriented programming, asynchronous method invocation , also known as asynchronous method calls or asynchronous pattern is a design pattern for asynchronous invocation of potentially long-running methods of an object.It is equivalent to the IOU pattern described in 1996 by Allan...

 and a scheduler
Scheduling (computing)
In computer science, a scheduling is the method by which threads, processes or data flows are given access to system resources . This is usually done to load balance a system effectively or achieve a target quality of service...

 for handling requests.
Balking
Balking pattern
The balking pattern is a software design pattern that only executes an action on an object when the object is in a particular state. For example, if an object reads ZIP files and a calling method invokes a get method on the object when the ZIP file is not open, the object would "balk" at the request...

Only execute an action on an object when the object is in a particular state.
Binding properties Combining multiple observers to force properties in different objects to be synchronized or coordinated in some way.
Messaging design pattern (MDP) Allows the interchange of information (i.e. messages) between components and applications.
Double-checked locking Reduce the overhead of acquiring a lock by first testing the locking criterion (the 'lock hint') in an unsafe manner; only if that succeeds does the actual lock proceed.
Can be unsafe when implemented in some language/hardware combinations. It can therefore sometimes be considered an anti-pattern
Anti-pattern
In software engineering, an anti-pattern is a pattern that may be commonly used but is ineffective and/or counterproductive in practice.The term was coined in 1995 by Andrew Koenig,...

.
Event-based asynchronous Addresses problems with the asynchronous pattern that occur in multithreaded programs.
Guarded suspension
Guarded suspension
In concurrent programming, guarded suspension is a software design pattern for managing operations that require both a lock to be acquired and a precondition to be satisfied before the operation can be executed...

Manages operations that require both a lock to be acquired and a precondition to be satisfied before the operation can be executed.
Lock
Lock (computer science)
In computer science, a lock is a synchronization mechanism for enforcing limits on access to a resource in an environment where there are many threads of execution. Locks are one way of enforcing concurrency control policies.-Types:...

One thread puts a "lock" on a resource, preventing other threads from accessing or modifying it.
Monitor object
Monitor (synchronization)
In concurrent programming, a monitor is an object or module intended to be used safely by more than one thread. The defining characteristic of a monitor is that its methods are executed with mutual exclusion. That is, at each point in time, at most one thread may be executing any of its methods...

An object whose methods are subject to mutual exclusion
Mutual exclusion
Mutual exclusion algorithms are used in concurrent programming to avoid the simultaneous use of a common resource, such as a global variable, by pieces of computer code called critical sections. A critical section is a piece of code in which a process or thread accesses a common resource...

, thus preventing multiple objects from erroneously trying to use it at the same time.
Reactor
Reactor pattern
The reactor design pattern is an event handling pattern for handling service requests delivered concurrently to a service handler by one or more inputs...

A reactor object provides an asynchronous interface to resources that must be handled synchronously.
Read-write lock Allows concurrent read access to an object, but requires exclusive access for write operations.
Scheduler
Scheduler pattern
In computer programming, the scheduler pattern is a software design pattern. It is a concurrency pattern used to explicitly control when threads may execute single-threaded code, like write operation to a file....

Explicitly control when threads may execute single-threaded code.
Thread pool
Thread pool pattern
In computer programming, the thread pool pattern is where a number of threads are created to perform a number of tasks, which are usually organized in a queue. Typically, there are many more tasks than threads. As soon as a thread completes its task, it will request the next task from the queue...

A number of threads are created to perform a number of tasks, which are usually organized in a queue. Typically, there are many more tasks than threads. Can be considered a special case of the object pool
Object pool
In computer programming, an object pool is a software design pattern. An object pool is a set of initialised objects that are kept ready to use, rather than allocated and destroyed on demand. A client of the pool will request an object from the pool and perform operations on the returned object...

 pattern.
Thread-specific storage Static or "global" memory local to a thread.

Documentation

The documentation for a design pattern describes the context in which the pattern is used, the forces within the context that the pattern seeks to resolve, and the suggested solution. There is no single, standard format for documenting design patterns. Rather, a variety of different formats have been used by different pattern authors. However, according to Martin Fowler
Martin Fowler
-Online presentations:* at RailsConf 2006* at JAOO 2006* at QCon London 2007 * at QCon London 2008 * at ThoughtWorks Quarterly Technology Briefing, October 2008...

, certain pattern forms have become more well-known than others, and consequently become common starting points for new pattern-writing efforts. One example of a commonly used documentation format is the one used by Erich Gamma
Erich Gamma
Erich Gamma is Swiss computer scientist and co-author of the influential Software engineering textbook, Design Patterns: Elements of Reusable Object-Oriented Software. He co-wrote the JUnit software testing framework with Kent Beck and led the design of the Eclipse platform's Java Development Tools...

, Richard Helm, Ralph Johnson and John Vlissides
John Vlissides
John Matthew Vlissides was a software scientist known mainly as one of the four authors of the book Design Patterns: Elements of Reusable Object-Oriented Software...

 (collectively known as the "Gang of Four", or GoF for short) in their book Design Patterns. It contains the following sections:
  • Pattern Name and Classification: A descriptive and unique name that helps in identifying and referring to the pattern.
  • Intent: A description of the goal behind the pattern and the reason for using it.
  • Also Known As: Other names for the pattern.
  • Motivation (Forces): A scenario consisting of a problem and a context in which this pattern can be used.
  • Applicability: Situations in which this pattern is usable; the context for the pattern.
  • Structure: A graphical representation of the pattern. Class diagrams and Interaction diagrams may be used for this purpose.
  • Participants: A listing of the classes and objects used in the pattern and their roles in the design.
  • Collaboration: A description of how classes and objects used in the pattern interact with each other.
  • Consequences: A description of the results, side effects, and trade offs caused by using the pattern.
  • Implementation: A description of an implementation of the pattern; the solution part of the pattern.
  • Sample Code: An illustration of how the pattern can be used in a programming language.
  • Known Uses: Examples of real usages of the pattern.
  • Related Patterns: Other patterns that have some relationship with the pattern; discussion of the differences between the pattern and similar patterns.

Criticism

The concept of design patterns has been criticized in several ways.

The design patterns may just be a sign of some missing features of a given programming language (Java or C++ for instance). Peter Norvig demonstrates that 16 out of the 23 patterns in the Design Patterns book (which is primarily focused on C++) are simplified or eliminated (via direct language support) in Lisp or Dylan. See also Paul Graham's essay Revenge of the Nerds.

The idea may not be as new as suggested by the authors: for instance the Model-View-Controller
Model-view-controller
Model–view–controller is a software architecture, currently considered an architectural pattern used in software engineering. The pattern isolates "domain logic" from the user interface , permitting independent development, testing and maintenance of each .Model View Controller...

 paradigm is an example of a "pattern" which predates the concept of "design patterns" by several years.

Moreover, shifting the code too far forcing it to look like a standard pattern unnecessarily increases complexity.

See also

  • Abstraction principle
    Abstraction principle (programming)
    In software engineering and programming language theory, the abstraction principle is a basic dictum that aims to reduce duplication of information in a program whenever practical by making use of abstractions provided by the programming language or software libraries...

  • Algorithmic skeleton
    Algorithmic skeleton
    In computing, algorithmic skeletons are a high-level parallel programming model for parallel and distributed computing....

  • Anti-pattern
    Anti-pattern
    In software engineering, an anti-pattern is a pattern that may be commonly used but is ineffective and/or counterproductive in practice.The term was coined in 1995 by Andrew Koenig,...

  • Architectural pattern
    Architectural pattern (computer science)
    An architectural pattern in software is a standard design in the field of software architecture. The concept of a software architectural pattern has a broader scope than the concept of a software design pattern...

  • Business pattern
    Business pattern
    A business pattern is a generic description of rules used by software engineers to create solutions suitable for a given business.Historically, the business patterns catalog appeared during the nineties with the development of object oriented technologies and the e-business.- Notes :*Hruby, P.,...

  • Distributed design patterns
    Distributed design patterns
    In software engineering, a distributed design pattern is a design pattern focused on distributed computing problems.-Classification:Distributed design patterns can be divided into several groups:* Distributed communication patterns...

  • Double-chance function
    Double-chance function
    In software engineering, a double-chance function is a software design pattern with a strong application in cross-platform and scalable development. It is easiest to explain it with an example....

  • Enterprise Architecture framework
  • GRASP (object-oriented design)
  • Interaction design pattern
    Interaction design pattern
    Interaction design patterns are a way to describe solutions to common usability or accessibility problems in a specific context. They document interaction models that make it easier for users to understand an interface and accomplish their tasks.-History:...

  • List of software development philosophies
  • List of software engineering topics
  • Pattern language
    Pattern language
    A pattern language, a term coined by architect Christopher Alexander, is a structured method of describing good design practices within a field of expertise. Advocates of this design approach claim that ordinary people of ordinary intelligence can use it to successfully solve very large, complex...

  • Pattern theory
    Pattern theory
    Pattern theory, formulated by Ulf Grenander, is a mathematical formalism to describe knowledge of the world as patterns. It differs from other approaches to artificial intelligence in that it does not begin by prescribing algorithms and machinery to recognize and classify patterns; rather, it...

  • Pedagogical patterns
    Pedagogical patterns
    Pedagogical Patterns are high-level patterns that have been recognized in many areas of training and pedagogy such as group work, software design, human computer interaction, education and others. The concept is an extension of pattern languages...

  • Portland Pattern Repository
    Portland Pattern Repository
    The Portland Pattern Repository is a repository for computer programming design patterns. It was accompanied by a companion website, WikiWikiWeb, which was the world's first wiki....

  • Refactoring
    Refactoring
    Code refactoring is "disciplined technique for restructuring an existing body of code, altering its internal structure without changing its external behavior", undertaken in order to improve some of the nonfunctional attributes of the software....

  • Software development methodology
    Software development methodology
    A software development methodology or system development methodology in software engineering is a framework that is used to structure, plan, and control the process of developing an information system.- History :...



External links

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK