Design pattern (computer science)
In software engineering, a design pattern is a general solution to a common problem in software design. A design pattern isn't 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.
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: 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.
~ Table of Content ~
| ► | Introduction |
| ► | History |
| ► | Uses |
| ► | Classification |
| ► | Documentation |
| ► | Critique |
| ► | See also |
| ► | References |
| ► | External links |
~ What's Hot ~
~ Community ~
| ► | History Forum Come and discuss about History, Civilizations, Historical Events and Figures |
| ► | History Web-Ring A community of sites, blogs and forums dedicated to History. Do not hesitate to submit your site. |
and are licensed under the GNU Free Documentation License.
Lexicon - Privacy Policy - Spiritus-Temporis.com ©2005.