Design pattern (computer science)

It contains the following sections: In the field of computer science, there exist some criticisms regarding the concept of design patterns. Users of dynamic programming languages have discussed many design patterns as workarounds for the limitations of languages such as C++ and Java. In software engineering, a design pattern is a general reusable solution to a commonly occurring problem in software design.

These techniques are difficult to apply to a broader range of problems. 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, 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.

Effective software design requires considering issues that may not become visible until later in the implementation. In a language with multimethods, such as Common Lisp, methods for a class are outside of the class structure, and one may add new methods without modifying it.

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. For further background on object-oriented design, see coupling and cohesion.

In the following years, Beck, Cunningham and others followed up on this work. Design patterns gained popularity in computer science 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.). For instance, algorithms solve computational problems rather than software design problems. Patterns originated as an architectural concept by Christopher Alexander (1977/79).

For further background on object-oriented programming, see inheritance, interface, and polymorphism. The scope of the term remains a matter of dispute.

Examples include user interface design patterns, The annual Pattern Languages of Programming Conference proceedings include many examples of domain specific patterns. Design patterns were originally grouped into the categories Creational patterns, Structural patterns, and Behavioral patterns, and described them using the concepts of delegation, aggregation, and consultation. That same year, the first Pattern Languages of Programming Conference was held and the following year, the Portland Pattern Repository was set up for documentation of design patterns.

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.

In 1987, Kent Beck and Ward Cunningham began experimenting with the idea of applying patterns to programming and presented their results at the OOPSLA conference that year. 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. Design patterns can speed up the development process by providing tested, proven development paradigms.

Object-oriented design patterns typically show relationships and interactions between classes or objects, without specifying the final application classes or objects that are involved. Design patterns reside in the domain of modules and interconnections. It is a description or template for how to solve a problem that can be used in many different situations.

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. In C++, a class is declared as a syntactic structure with a specific and closed set of methods.

Of particular interest are the Structure, Participants, and Collaboration sections. A design pattern is not a finished design that can be transformed directly into code.

Norvig and others have described language features that encapsulate or replace various patterns that a C++ user must implement for themselves. Some authors . The purpose of Visitor is to add new operations to existing classes without modifying those classes.

Common design patterns can be improved over time, making them more robust than ad-hoc designs. 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. It can therefore sometimes be considered an anti-pattern. 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.

One example of a commonly used documentation format is the one used by Erich Gamma, Richard Helm, Ralph Johnson and John Vlissides (collectively known as the Gang of Four , or GoF for short) in their book Design Patterns. Since some authors see this as a step backward from software reuse as provided by components, researchers have worked to turn patterns into components.

Design patterns provide general solutions, documented in a format that doesn t require specifics tied to a particular problem. Design patterns are composed of several sections (see Documentation below). At a higher level there are Architectural patterns that are larger in scope, usually describing an overall pattern followed by an entire system. Not all software patterns are design patterns.

Similarly, the Decorator pattern amounts to implementing dynamic delegation, as found in Common Lisp, Objective C, Self and JavaScript. Peter Norvig, in Design Patterns in Dynamic Programming, discusses the triviality of implementing various patterns in dynamic languages. For instance, the Visitor pattern need not be implemented in a language that supports multimethods.

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. The pattern, when implemented in some language/hardware combinations, can be unsafe.
 
?>