Web - Amazon

We provide Linux to the World


We support WINRAR [What is this] - [Download .exe file(s) for Windows]

CLASSICISTRANIERI HOME PAGE - YOUTUBE CHANNEL
SITEMAP
Audiobooks by Valerio Di Stefano: Single Download - Complete Download [TAR] [WIM] [ZIP] [RAR] - Alphabetical Download  [TAR] [WIM] [ZIP] [RAR] - Download Instructions

Make a donation: IBAN: IT36M0708677020000000008016 - BIC/SWIFT:  ICRAITRRU60 - VALERIO DI STEFANO or
Privacy Policy Cookie Policy Terms and Conditions
Design pattern (computer science) - Wikipedia, the free encyclopedia

Design pattern (computer science)

From Wikipedia, the free encyclopedia

{{Hide = {{{

"Hybrid" reference style allows grouped references at top, but uses m:Cite.php style named references in article body. See http://en.wikipedia.org/wiki/User:CitationTool/Hybrid_referencing for a discussion.

[1] [2] [3] [4] [5] [6] [7] [8]

}}}}}

In software engineering, a design pattern is a general repeatable solution to a commonly occurring problem in software design. 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 interactions between classes or objects, without specifying the final application classes or objects that are involved. Algorithms are not thought of as design patterns, since they solve computational problems rather than design problems.

See also: Anti-pattern

Contents

[edit] History

Patterns originated as an architectural concept by Christopher Alexander (1977/79). 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[1][2]. 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 (Gamma et al). That same year, the first Pattern Languages of Programs conference was held and the following year, the Portland Pattern Repository was set up for documentation of design patterns. The scope of the term remained a matter of dispute into the next decade.

[edit] Uses

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 improves code readability for coders and architects familiar with the 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 in a format that doesn't require specifics tied to a particular problem.

Design patterns are composed of several sections (see Documentation). 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.

[edit] Classification

Design patterns can be classified in terms of the underlying problem they solve. Examples of problem-based pattern classifications include:

[edit] Documentation

The documentation for a design pattern should contain enough information about the problem that the pattern addresses, the context in which it is used, and the suggested solution. Nonetheless, authors use their own layouts to document design patterns, and these layouts usually resemble the essential parts. The authors usually include additional sections to provide more information, and organize the essential parts in different sections, possibly with different names.

A commonly used format is the one used by the Gang of Four. It contains the following sections:

  • Pattern Name and Classification: Every pattern should have a descriptive and unique name that helps in identifying and referring to it. Additionally, the pattern should be classified according to a classification such as the one described earlier. This classification helps in identifying the use of the pattern.
  • Intent: This section should describe the goal behind the pattern and the reason for using it. It resembles the problem part of the pattern.
  • Also Known As: A pattern could have more than one name. These names should be documented in this section.
  • Motivation(Forces): This section provides a scenario consisting of a problem and a context in which this pattern can be used. By relating the problem and the context, this section shows when this pattern is used.
  • Applicability: This section includes situations in which this pattern is usable. It represents the context part of the pattern.
  • Structure: A graphical representation of the pattern. Class diagrams and Interaction diagrams can be used for this purpose.
  • Participants: A listing of the classes and objects used in this pattern and their roles in the design.
  • Collaboration: Describes how classes and objects used in the pattern interact with each other.
  • Consequences: This section describes the results, side effects, and trade offs caused by using this pattern.
  • Implementation: This section describes the implementation of the pattern, and represents the solution part of the pattern. It provides the techniques used in implementing this pattern, and suggests ways for this implementation.
  • Sample Code: An illustration of how this pattern can be used in a programming language
  • Known Uses: This section includes examples of real usages of this pattern.
  • Related Patterns: This section includes other patterns that have some relation with this pattern, so that they can be used along with this pattern, or instead of this pattern. It also includes the differences this pattern has with similar patterns.

[edit] Criticism

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

[edit] Targets the wrong problem

The need for patterns results from using computer languages or techniques with insufficient abstraction ability. Under ideal factoring, a concept should not be copied, but merely referenced. But if something is referenced instead of copied, then there is no "pattern" to label and catalog. Paul Graham writes in the essay Revenge of the Nerds[3].

This practice is not only common, but institutionalized. For example, in the OO world you hear a good deal about "patterns". I wonder if these patterns are not sometimes evidence of case (c), the human compiler, at work. When I see patterns in my programs, I consider it a sign of trouble. The shape of a program should reflect only the problem it needs to solve. Any other regularity in the code is a sign, to me at least, that I'm using abstractions that aren't powerful enough -- often that I'm generating by hand the expansions of some macro that I need to write.

Peter Norvig provides a similar argument. He 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[4].

Further arguments along this line are discussed on Portland Pattern Repository's wiki.[5][6]

[edit] Lacks formal foundations

The study of design patterns has been excessively ad hoc, and some have argued that the concept sorely needs to be put on a more formal footing. At OOPSLA 1999, the Gang of Four were (with their full cooperation) subjected to a show trial[7], in which they were "charged" with numerous crimes against computer science. They were "convicted" by 2/3 of the "jurors" who attended the trial[8].

[edit] Unlike components, does not provide reuse

A pattern must be programmed anew into each application that uses it. Some authors see this as a step backward from software reuse as provided by components. This observation has led to work on "componentization": turning patterns into components, in particular by Meyer and Arnout, who claim a 2/3rds success rate in componentizing the best-known patterns. [9]


[edit] Does not differ significantly from other abstractions

Some authors allege that design patterns don't differ significantly from other forms of abstraction[10], and that the use of new terminology (borrowed from the architecture community) to describe existing phenomena in the field of programming is unnecessary. The Model-View-Controller paradigm is touted as an example of a "pattern" which predates the concept of "design patterns" by several years.[11] 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. [citation needed]

[edit] See also

[edit] References

  1. ^ a b Smith, R. (October 1987). "Panel on design methodology". OOPSLA '87 Addendum to the Proceedings., "Ward cautioned against requiring too much programming at, what he termed, 'the high level of wizards.' He pointed out that a written 'pattern language' can significantly improve the selection and application of abstractions. He proposed a 'radical shift in the burden of design and implementation' basing the new methodology on an adaptation of Christopher Alexander's work in pattern languages and that programming-oriented pattern languages developed at Tektronix has significantly aided their software development efforts."
  2. ^ a b Beck, K.; Ward Cunningham (September 1987). Using Pattern Languages for Object-Oriented Program. Retrieved on 2006-05-26. Submitted to the OOPSLA '87 workshop on the Specification and Design for Object-Oriented Programming
  3. ^ a b Paul Graham (May 2002). Revenge of the Nerds. Retrieved on 2006-01-20.
  4. ^ a b Peter Norvig (1998-03-17). Design Patterns in Dynamic Programming. Retrieved on 2006-01-20.
  5. ^ a b Are Design Patterns Missing Language Features?. Cunningham & Cunningham, Inc.. Retrieved on 2006-01-20.
  6. ^ a b Design Patterns in Dynamic Programming. Cunningham & Cunningham, Inc.. Retrieved on 2006-01-20.
  7. ^ a b Show Trial of the Gang of Four. Cunningham & Cunningham, Inc.. Retrieved on 2006-01-20.
  8. ^ a b Show Trial Verdict. Cunningham & Cunningham, Inc.. Retrieved on 2006-01-20.
  9. ^ Meyer, B. and Arnout, K.: Componentization: The Visitor Example, IEEE Computer, vol. 39, issue 7, pages 23-30, July 2006, pre-publication version available online
  10. ^ http://www.lukew.com/ff/entry.asp?348
  11. ^ http://rd13doc.cern.ch/Notes/004/Note004-7.html

[edit] Further reading

[edit] External links

Our "Network":

Project Gutenberg
https://gutenberg.classicistranieri.com

Encyclopaedia Britannica 1911
https://encyclopaediabritannica.classicistranieri.com

Librivox Audiobooks
https://librivox.classicistranieri.com

Linux Distributions
https://old.classicistranieri.com

Magnatune (MP3 Music)
https://magnatune.classicistranieri.com

Static Wikipedia (June 2008)
https://wikipedia.classicistranieri.com

Static Wikipedia (March 2008)
https://wikipedia2007.classicistranieri.com/mar2008/

Static Wikipedia (2007)
https://wikipedia2007.classicistranieri.com

Static Wikipedia (2006)
https://wikipedia2006.classicistranieri.com

Liber Liber
https://liberliber.classicistranieri.com

ZIM Files for Kiwix
https://zim.classicistranieri.com


Other Websites:

Bach - Goldberg Variations
https://www.goldbergvariations.org

Lazarillo de Tormes
https://www.lazarillodetormes.org

Madame Bovary
https://www.madamebovary.org

Il Fu Mattia Pascal
https://www.mattiapascal.it

The Voice in the Desert
https://www.thevoiceinthedesert.org

Confessione d'un amore fascista
https://www.amorefascista.it

Malinverno
https://www.malinverno.org

Debito formativo
https://www.debitoformativo.it

Adina Spire
https://www.adinaspire.com