All Topics  
Design pattern (computer science)

 

   Email Print
   Bookmark   Link






 

Design pattern (computer science)



 
 
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....
, a design pattern is a general reusable solution to a commonly occurring problem 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 programming language construct that is used as a blueprint to create Object s. This blueprint includes Attribute s and Method s that the created objects all share....
es or object
Object (computer science)

In its simplest embodiment, an object is an allocated region of storage. Since programming languages use variable#Computer_programmings to access objects, the terms object and variable are often used interchangeably....
s, without specifying the final application classes or objects that are involved.






Discussion
Ask a question about 'Design pattern (computer science)'
Start a new discussion about 'Design pattern (computer science)'
Answer questions from other users
Full Discussion Forum



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....
, a design pattern is a general reusable solution to a commonly occurring problem 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 programming language construct that is used as a blueprint to create Object s. This blueprint includes Attribute s and Method s that the created objects all share....
es or object
Object (computer science)

In its simplest embodiment, an object is an allocated region of storage. Since programming languages use variable#Computer_programmings to access objects, the terms object and variable are often used interchangeably....
s, without specifying the final application classes or objects that are involved. Algorithms are not thought of as design patterns, since they solve computation
Computation

Computation is a general term for any type of information processing. This includes phenomena ranging from human thinking to calculations with a more narrow meaning....
al problems rather than 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....
 problems.

Not all software patterns are design patterns. Design patterns deal specifically with problems at the level of software design. Other kinds of patterns, such as architectural patterns
Architectural pattern (computer science)

Architectural patterns are software patterns that offer well-established solutions to software architecture problems in software engineering. It gives description of the elements and relation type together with a set of constraints on how they may be used....
, describe problems and solutions that have alternative scopes.

History

Patterns originated as an architectural concept by Christopher Alexander
Christopher Alexander

Christopher Alexander is an 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 Extreme Programming, developed while he was serving as project leader on Chrysler Comprehensive Compensation , a long-term project for employee payroll that was canceled just under 4 years after it was started....
 and Ward Cunningham
Ward Cunningham

Howard G. "Ward" Cunningham is the United States computer programmer who developed the first wiki. A pioneer in both Design pattern s and Extreme Programming, he started programming the software WikiWikiWeb in 1994 and installed it on the website of his software consultancy, Cunningham & Cunningham , on March 25, 1995, as an add-on to the Po...
 began experimenting with the idea of applying patterns to programming and presented their results at the OOPSLA
OOPSLA

OOPSLA is an annual Association for Computing Machinery conference.OOPSLA is an annual conference covering topics on object-oriented programming systems, languages and applications....
 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 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 (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 patterns, cf....
 Conference was held and the following year, the Portland Pattern Repository
Portland Pattern Repository

The Portland Pattern Repository is a repository for design pattern s. 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 the practical application of design patterns is a phenomenon, formalization of the concept of a design pattern languished for several years.

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....
, 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 claim a two-thirds success rate in componentizing the best-known patterns.

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 may refer to the process of providing evidence or to the communicable material used to provide such documentation . Documentation may also refer to tools aiming at identifying documents or to the field of study devoted to the study of documents and bibliographies ....
 in a format that doesn't require specifics tied to a particular problem.

Structure

Design patterns are composed of several sections (see Documentation
Design pattern (computer science)

In software engineering, a design pattern is a general reusable solution to a commonly occurring problem in software design. A design pattern is not a finished design that can be transformed directly into code ....
 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, 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 design patterns, Information Visualization
Information visualization

File:HaloVisualizationTechnique.pngInformation visualization the interdisciplinary study of the visualisation Representation of large-scale collections of non-numerical information, such as files and lines of code in software systems, and the use of graphical techniques to help people understand and analyze data....
 , Secure Usability and web design.

The 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 patterns, cf....
 Conference (annual, 1994—) includes many examples of domain specific patterns.

Classification

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....
s were originally grouped into the categories Creational pattern
Creational pattern

In software engineering, creational design patterns are design pattern that deal with object lifetime mechanisms, trying to create objects in a manner suitable to the situation....
s, Structural pattern
Structural pattern

In software engineering, structural design patterns Design pattern that ease the design by identifying a simple way to realize relationships between entities....
s, and Behavioral pattern
Behavioral pattern

In software engineering, behavioral design patterns are design pattern s that identify common communication patterns between objects and realize these patterns....
s, and described them 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 Shared Behavior in Object-Oriented Systems"....
, aggregation, and consultation
Consultation (object-oriented programming)

Consultation in object-oriented programming occurs when an object's method implementation consists of a message send of the same message to another constituent object....
. 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 ....
 and cohesion
Cohesion (computer science)

In computer programming, cohesion is a measure of how strongly-related and focused the various responsibilities of a software module are. Cohesion is an level of measurement#Ordinal measurement type of measurement and is usually expressed as "high cohesion" or "low cohesion" when being discussed....
. For further background on object-oriented programming, see inheritance
Inheritance (computer science)

In object-oriented programming, inheritance is a way to form new class es using classes that have already been defined. The inheritance concept was invented in 1967 for Simula....
, interface
Interface (computer science)

Interface generally refers to an Abstraction_%28computer_science%29 that an entity provides of itself to the outside. This separates the methods of external communication from internal operation, and allows it to be internally modified without affecting the way outside entities interact with it, as well as provide Polymorphism in object-orien...
, and polymorphism
Polymorphism in object-oriented programming

In simple terms, polymorphism is the ability of one type, A, to appear as and be used like another type, B. In strongly typed languages, this usually means that type A somehow derives from type B, or type A implements an interface that represents type B....
. Another classification has also introduced the notion of architectural design pattern
Architectural pattern (computer science)

Architectural patterns are software patterns that offer well-established solutions to software architecture problems in software engineering. It gives description of the elements and relation type together with a set of constraints on how they may be used....
 which may be applied at the architecture level of the software such as the Model-View-Controller
Model-view-controller

Model?View?Controller is an Architectural pattern used in software engineering. Successful use of the pattern isolates business logic from user interface considerations, resulting in an application where it is easier to modify either the visual appearance of the application or the underlying business rules without affecting the other....
 pattern.

Name Description In Design Patterns (book) In Code Complete
Code Complete

Code Complete is a software development book, written by Steve McConnell and published by Microsoft Press, urging developers to get past code and fix programming and the "big design up front" waterfall model....
Creational pattern
Creational pattern

In software engineering, creational design patterns are design pattern that deal with object lifetime mechanisms, trying to create objects in a manner suitable to the situation....
s
Abstract factory
Abstract factory pattern

A software Design pattern , the Abstract Factory Pattern provides a way to encapsulate a group of individual factory object that have a common theme....
Provide an interface for creating families of related or dependent objects without specifying their concrete classes.
Factory method
Factory method pattern

The factory method pattern is an object-oriented design pattern .Like other creational patterns, it deals with the problem of creating object without specifying the exact class of object that will be created....
Define an interface for creating an object, but let subclasses decide which class to instantiate. Factory Method lets a class defer instantiation to subclasses.
Builder
Builder pattern

The Builder Pattern is a software Design pattern . The intention is to abstract steps of construction of object so that different implementations of these steps can construct different representations of objects....
Separate the construction of a complex object from its representation so that the same construction process can create different representations.
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.
Object pool
Object pool

In computer programming, an object pool is a software design pattern . An object pool is a set of initialised Object that are kept ready to use, rather than allocated and destroyed on demand....
Avoid expensive acquisition and release of resources by recycling objects that are no longer in use
Prototype
Prototype pattern

A 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.
Singleton
Singleton pattern

In software engineering, the singleton pattern is a design pattern that is used to restrict Instantiation of a class to one object-oriented programming....
Ensure a class has only one instance, and provide a global point of access to it.
Resource acquisition is initialization
Resource Acquisition Is Initialization

Resource Acquisition Is Initialization, often referred to by the acronym RAII, is a popular design pattern in several Object-oriented_programming_language like C++, D and Ada ....
Ensure that resources are properly released by tying them to the lifespan of suitable objects.
Structural pattern
Structural pattern

In software engineering, structural design patterns Design pattern that ease the design by identifying a simple way to realize relationships between entities....
s
Adapter
Adapter pattern

In computer programming, the adapter design pattern translates one Interface for a Class into a compatible interface. An adapter allows classes to work together that normally could not because of incompatible interfaces, by providing its interface to clients while using the original interface....
Convert the interface of a class into another interface clients expect. Adapter lets classes work together that couldn't 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 so that the two can vary independently.
Composite
Composite pattern

In computer science, the composite pattern is a partitioning design pattern . Composite allows a group of objects to be treated in the same way as a single instance of an object....
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 new/additional behaviour to be added to an existing Class dynamically....
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.A facade is an object that provides a simplified interface to a larger body of code, such as a class library....
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.
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....
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 pattern s that identify common communication patterns between objects and realize these patterns....
s
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 Information Hiding 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 Graphics software, 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 particular design pattern . The basic idea is to have a Class_ for each symbol in a Domain specific languages, so that the language's abstract syntax tree is an instance of the composite pattern pattern....
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 iterator are used to access the elements of an aggregate object sequentially without exposing its underlying representation....
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 software design pattern described in Design Patterns, provides a unified interface to a set of interfaces in a subsystem....
Define an object that encapsulates how a set of objects interact. Mediator promotes loose coupling
Loose coupling

Loose coupling describes a resilient relationship between two or more systems or organizations with some kind of exchange relationship. Each end of the transaction makes its requirements explicit and makes few assumptions about the other end....
 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 design pattern that provides the ability to restore an object to its previous state .The memento pattern is used by two objects: the originator and a caretaker....
Without violating encapsulation, capture and externalize an object's internal state so that the object can 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 ....
designed to act as a default value of an object.
Observer
Observer pattern

The observer pattern is a design pattern in which an Object #Objects_in_object-oriented_programming , 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 Method ....
Define a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically.
State
State pattern

The state pattern is a Behavioral pattern 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 ....
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 design pattern , whereby algorithms can be selected at runtime.In some programming languages, such as those without Polymorphism , the issues addressed by this pattern are handled through forms of Reflection , such as the native function pointer or function Delegation syntax....
Define a family of algorithms, encapsulate each one, and make them interchangeable. Strategy lets the algorithm vary independently from clients that use it.
Specification
Specification pattern

In computer programming, the specification pattern is a particular software design pattern, whereby business logic can be recombined by chaining the business logic together using boolean logic....
Recombinable business logic in a boolean fashion
Template method
Template method pattern

In software engineering, the template method pattern is a software design pattern.It is a so-called behavioral pattern, and is unrelated to template ....
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 upon which it operates....
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.
Concurrency pattern
Concurrency pattern

In software engineering, concurrency patterns are those types of design pattern that deal with multi-threaded programming paradigm.Examples of this class of patterns include:...
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 Scheduling for handling requests....
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.
Event-Based Asynchronous The event-based asynchronous design pattern addresses problems with the Asychronous Pattern that occur in multithreaded programs.
Balking
Balking pattern

The Balking pattern is a 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 file format 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....
The Balking pattern is a software design pattern that only executes an action on an object when the object is in a particular state.
Double checked locking Double-checked locking is a software design pattern also known as "double-checked locking optimization". The pattern is designed to 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. The pattern, when implemented in some language/hardware combinations, can be unsafe. It can therefore sometimes be considered to be an anti-pattern.
Guarded
Guarded suspension

In concurrent computing, guarded suspension is a 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....
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.
Monitor object
Monitor (synchronization)

In concurrent programming, a monitor is an Object 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....
A monitor is an approach to synchronize two or more computer tasks that use a shared resource, usually a hardware device or a set of variables.
Read write lock A read/write lock pattern or simply RWL is a software design pattern that 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 thread s may execution single-threaded source code....
The scheduler pattern is a software design pattern. It is a concurrency pattern used to explicitly control when threads may execute single-threaded code.
Thread pool
Thread pool pattern

In the thread pool Design_pattern_ in programming, a number of thread are created to perform a number of tasks, which are usually organized in a Queue ....
In the thread pool pattern in programming, 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.
Thread-specific storage Thread-local storage (TLS) is a computer programming method that uses static or global memory local to a thread.
Reactor
Reactor pattern

The reactor design pattern is a concurrent programming pattern for handling service requests delivered Concurrency to a service handler by one or more inputs....
The reactor design pattern is a concurrent programming pattern for handling service requests delivered concurrently to a service handler by one or more inputs. The service handler then demultiplexes the incoming requests and dispatches them synchronously to the associated request handlers.


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

Martin Fowler is an author and international speaker on software development, specializing in object oriented programming analysis and design, Unified Modeling Language, Design pattern , and agile software development methodologies, including extreme programming....
 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 a co-author of the influential computer science textbook, Design Patterns . 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
Richard Helm

Richard Helm is currently with The Boston Consulting Group. He has some degree of fame as one of the "Gang of Four" for being a co-author of the award winning book...
, Ralph Johnson
Ralph Johnson

Ralph E. Johnson is a Research Associate Professor in the Department of Computer Science at the University of Illinois at Urbana-Champaign. He is a co-author of the influential computer science textbook Design Patterns ....
 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 . Vlissides referred to himself as "#4 of the Gang of Four and wouldn't have it any other way"....
 (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 diagram
    Unified Modeling Language

    Unified Modeling Language is a standardized general-purpose modeling language in the field of software engineering.UML includes a set of graphical notation techniques to create abstract models of specific systems....
    s 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


In the field of computer science, there exist some criticisms regarding the concept of design patterns.

Workarounds for missing language features

Users of dynamic programming language
Dynamic programming language

Dynamic programming language is a term used broadly in computer science to describe a class of high-level programming languages that execute at runtime many common behaviors that other languages might perform during compiler, if at all....
s have discussed many design patterns as workarounds for the limitations of languages such as C++
C++

C++ is a general-purpose programming language. It is regarded as a middle-level language, as it comprises a combination of both high-level programming language and low-level programming language language features....
 and Java
Java (programming language)

Java is a programming language originally developed by James Gosling at Sun Microsystems and released in 1995 as a core component of Sun Microsystems' Java ....
. For instance, the Visitor pattern need not be implemented in a language that supports multimethods. The purpose of Visitor is to add new operations to existing classes without modifying those classes. In C++, a class is declared as a syntactic structure with a specific and closed set of methods. In a language with multimethods, such as Common Lisp
Common Lisp

Common Lisp, commonly abbreviated CL, is a dialect of the Lisp programming language, published in American National Standards Institute standard document Information Technology - Programming Language - Common Lisp, formerly X3.226-1994 ....
, methods for a class are outside of the class structure, and one may add new methods without modifying it. Similarly, the Decorator pattern amounts to implementing dynamic 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 Shared Behavior in Object-Oriented Systems"....
, as found in Common Lisp, Objective C, Self and JavaScript
JavaScript

JavaScript is a scripting language widely used for client-side web development. It was the originating Programming language dialect of the ECMAScript standard....
.

Peter Norvig
Peter Norvig

Peter Norvig is an United States computer science. He is currently the Director of Research at GoogleHe is a Fellow and Councilor of the American Association for Artificial Intelligence and co-author, with Stuart J....
, in Design Patterns in Dynamic Programming, discusses the triviality of implementing various patterns in dynamic languages
Dynamic programming language

Dynamic programming language is a term used broadly in computer science to describe a class of high-level programming languages that execute at runtime many common behaviors that other languages might perform during compiler, if at all....
. Norvig and others have described language features that encapsulate or replace various patterns that a C++ user must implement for themselves.

Does not differ significantly from other abstractions

Some authors allege that design patterns don't differ significantly from other forms of abstraction
Abstraction (computer science)

In computer science, abstraction is a mechanism and practice to reduce and factor out details so that one can focus on a few concepts at a time....
, and that the use of new terminology (borrowed from the architecture
Architecture

The term architecture can refer to a process, a profession or documentation.As a process, architecture is the activity of designing and construction buildings and other physical structures by a person or a computer, primarily to provide shelter....
 community) to describe existing phenomena in the field of programming is unnecessary. The Model-View-Controller
Model-view-controller

Model?View?Controller is an Architectural pattern used in software engineering. Successful use of the pattern isolates business logic from user interface considerations, resulting in an application where it is easier to modify either the visual appearance of the application or the underlying business rules without affecting the other....
 paradigm is cited as an example of a "pattern" which predates the concept of "design patterns" by several years. It is further argued by some that the primary contribution of the Design Patterns community (and the Gang of Four book) was the use of Alexander's pattern language as a form of documentation; a practice which is often ignored in the literature.

See also


  • Anti-pattern
    Anti-pattern

    In software engineering, an anti-pattern is a design pattern that appears obvious but is ineffective or far from optimal in practice.The term was coined in 1995 by Andrew Koenig ,...
  • Architectural pattern
    Architectural pattern (computer science)

    Architectural patterns are software patterns that offer well-established solutions to software architecture problems in software engineering. It gives description of the elements and relation type together with a set of constraints on how they may be used....
  • Christopher Alexander
    Christopher Alexander

    Christopher Alexander is an architect noted for his theories about design, and for more than 200 building projects in California, Japan, Mexico and around the world....
  • Distributed design patterns
    Distributed design patterns

    In software engineering, a distributed design pattern is a design pattern focused in distributed computing problems....
  • GRASP (Object Oriented Design)
    GRASP (Object Oriented Design)

    GRASP stands for General Responsibility Assignment Software Patterns . It is used in Object-oriented design, and gives guidelines for assigning responsibility to classes and objects....
  • Interaction design pattern
    Interaction design pattern

    A design pattern is a formal way of documenting a solution to a common design problem. The idea was introduced by the architect Christopher Alexander for use in urban planning and building architecture, and has been adapted for various other disciplines, including teaching and pedagogy, development organization and process, and software architectu...
  • List of software development philosophies
    List of software development philosophies

    This is an incomplete list of approaches, styles, and philosophies in software development.* Agile software development* Agile Unified Process * Behavior Driven Development ...
  • List of software engineering topics
    List of software engineering topics

    This list complements the software engineering article, giving more details and examples.For an alphabetical listing of topics, please see List of software engineering topics ....
  • Pattern language
    Pattern language

    A pattern language is a structured method of describing good design practices within a field of expertise. It is characterized by # Noticing and naming the common problems in a field of interest,...
  • 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 prescribes a vocabulary to articulate and recast t...
  • Pedagogical patterns
    Pedagogical patterns

    In recent years the scope of pattern languages has expanded to include domains as diverse as group work, software design, human computer interaction, education, etc....
  • Portland Pattern Repository
    Portland Pattern Repository

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

    Code refactoring is the process of changing a computer program's internal structure without modifying its external Functional requirement behavior or existing functionality....
  • Business_pattern
    Business pattern

    A business pattern is a generic description of wiktionary:rules used by software engineers to create Business solution suitable for a given business....


Further reading

Books***********

Web sites*

External links

  • at hillside.net.
  • Ward Cunningham's Portland Pattern Repository.
  • Design Patterns library that aims to provide full or partial componentized version of all known Patterns in Java.
  • J2EE Pattern Oriented Framework
  • by Buschmann, Henney, and Schmidt
  • at oodesign.com