In software engineering, a design pattern is a general repeatable solution to a recurring problem in software design. A design pattern is not a finished design, it can be converted directly into code. How it is resolved, description or template that can be used in many different situations problem.

The use of design patterns
Design patterns can speed up the testing and validation by providing development model development process. Effective software design needs to take into account may not become visible until later in implementation. Reusable design patterns to help prevent possible lead to major problems, and improve the encoder and code readability architect familiar pattern delicate issue.

Often, people only understand how to apply certain software design techniques to certain problems. These techniques difficult to apply to a wider range of issues. Design patterns provide general solutions, it does not require a specific recording format depends on the specific problem.

In addition, the model allows the development of a known, readily understood as the name of the software communication interaction. Common design patterns can improve over time, making them more robust than ad hoc design.

Creational design patterns
Examples of these design patterns are all about class. This pattern can be further divided into two categories authoring mode to create patterns and objects. Although the class instantiation process patterns use inheritance to create effective, the object creation mode delegated the job done efficiently.

Example of abstract factories46

  • Abstract Factory
    Examples of a few families of the class is created
  • Builder
    Construct a detached object and its representation
  • Factory Method
    Creating multiple instances of a derived class
  • Pooling
    By recycling unused objects, avoid costly acquisition and release of resources
  • Prototype
    Fully initialized instance is copied or cloned
  • Only son
    Only one instance of the class can exist

Design Mode
These design patterns are all about a combination of classes and objects. Create a model class structure to use inheritance to compose interfaces. Way mode structure of an object defined by writing the object to get the new features.47

  • Adapter
    Different categories of game inte rfaces
  • Bridge
    Interface isolated object, its realization
  • Complex
    Simple and compound objects tree
  • Decoration
    Adding dynamic objects duties
  • Positive
    Represent a single class of the entire subsystem48
  • Flyweight
    For instance the efficient sharing of fine-grained
  • Private class data
    Restrict access / mutation access
  • Proxy
    Represent another object object

 

Behavior Design Patterns
The design pattern is all about communication objects of the class. Mode is a communication mode behavior most particularly to those objects.

  • Chain of Responsibility49
    Transfer request object chains manner
  • Command
    Package command request as an object
  • Translator
    A method comprising the language elements in a program
  • Iterator
    Sequential access to a collection of elements
  • Middleman
    Simplify the definition of communication between classes
  • Commemorate
    Internal state capture and restore objects
  • Null object
    Design as an object of defaults
  • Observed
    Notify change the number of classes in a way50
  • State
    Object changes its state to change behavior
  • Strategy
    Packaging category internal algorithms
  • Template Method
    Subclass postpone concrete steps algorithm
  • Tourist
    Define a new operation of a Class unchanged

Criticism
Conceptual design model has been some criticism in the field of computer science.

For the wrong question
Desired mode using the computer language or lead to inadequate technology and the ability to abstract. In an ideal factoring, the concept should not be copied, but only references. However, if the referenced instead of copied, then there is no “model” label and catalog. Paul Graham wrote in the article nerd revenge.

Peter Norvig provided a similar argument. He indicated that 16 in 23 mode design patterns book (which is mainly focused on C ++) to simplify or eliminate Lisp or Dylan (through direct language support).

Lack of a formal basis
Study design patterns have been temporary, but some people think that this concept is the need for a more formal status of the inputs. 1999 OOPSLA, the Gang of Four were (to cooperate fully with them) is subjected to a show trial, they are “accused” of computer science numerous crimes. Whom they participate in the trial of the “jury” of ⅔ “conviction.”

Lead to inefficient solutions
The idea of ​​a design pattern is what has been recognized as the best practices in an attempt to standardize. In principle, this may seem beneficial, but in practice it often leads to unnecessary duplication of code. It almost always use a good decomposition of the implementation, rather than “just barely good enough” design model is more effective solutions.

Did not differ significantly from other abstractions
Some authors claim that design patterns are not significantly different from other forms of abstraction and use new terminology (borrowed from the architectural community) to describe the existence of the phenomenon in the field of programming is unnecessary. Model – View – Controller pattern was regarded by it as early as the “design mode” concept a few years, an example of a “model”. It is further believed that by a number of major contributions to the design patterns community (Four Books and post) is the use of Alexander’s pattern language in the form of a document; it is often ignored in the literature practice.