Software Design Model

Source: Internet
Author: User
Tags read write lock

Design Mode(English:Design PatternThis term was introduced from the architectural design field to computer science by Erich Gamma and others in the 1990 s. It is a solution to all kinds of problems that occur frequently in software design. The design pattern is not directly used to write code, but to describe how to solve the problem in different situations. Object-Oriented Design Patterns generally describe the relationships and interactions between categories or objects, but do not involve specific categories or objects used to complete applications. Algorithms cannot be regarded as a design pattern, because they are mainly used to solve computing problems rather than design problems. The design pattern is mainly to make the unstable dependent on relatively stable, specific dependent on relative abstraction, to avoid the trouble of tight coupling, in order to enhance the ability of the software design to face and adapt to changes.

Not all software models are design patterns, but design patterns are specific to software.DesignHierarchy issues. There are other non-design models, such as the architecture model.

With the increasing interest of the software development community in design patterns, relevant monographs have been published, and relevant seminars have been held on a regular basis. Ward cunnheim invented wikiwiki to exchange experience in design patterns.

 

Development History

Architect Christian Alexander compiled a collection in 1977/79Design Mode. However, the influence of this design pattern in the architectural design field is far from the extensive spread in the software development field.

In 1987, Kent Baker and wod kanning developed the architectural design field using the ideas of Christo Buddha Alexander.Design ModeThis idea is applied to the generation of graphic user interfaces in Smalltalk. One year later, Erich Gamma began to try to adapt this idea to software development in his PhD thesis at the University of Zurich. At the same time, James coplien used the same idea to develop C ++ from 1989 to 1991, and then published his book in 1991.Advanced C ++ Idioms. This year Erich Gamma got his doctorate and went to the United States, where he collaborated with Richard Helm, Ralph Johnson, and John vlissidesDesign Patterns-elements of reusable object-oriented softwareThis book contains 23Design Mode.

In the field of software development, these four authors are also known as Gang of Four (gof) anonymously, and collaboration in this book has led to a breakthrough in the software design model. Sometimes this anonymous gof is used to refer to the book mentioned above.

 

Statement format

The format of expressing a software design pattern varies with the author, such as the division and name. The format of common gof description modes is roughly divided into the following parts:

  • Pattern name: each pattern has its own name. The pattern name allows us to discuss our design.
  • Problem: in specific situations that occur repeatedly during the object-oriented system design process, it leads us to adopt a certain mode.
  • Solution: the solution of the above problem provides the components of the design, the relationship between them, the division of duties and the way of collaboration.
  • Alias: A mode can have more than one name. These names should be noted in this section.
  • Motivation: This model should take advantage of the circumstances in which it is the responsibility of the solution provided in this section, including the problem and context.
  • Applicability: applicable situations and background of the mode.
  • Structure: This section describes the common class diagram and interaction diagram.
  • Participants: This section provides a list of classes and objects used in this model, and their roles under design.
  • Cooperation: Describes the interaction between classes and objects in this mode.
  • Impact: the impact of this mode on other parts of the software system, such as the expansion and portability of the system. The impact also includes negative effects. This part should describe the results, side effects, trade-off)
  • Implementation: This part should describe the implementation mode, some schemes of the mode, possible technologies for implementing the mode, or methods for implementing the mode.
  • Example: briefly describe how to use patterns in programming languages.
  • Known applications: an industry-known example of implementation.
  • Related mode: This part includes other related modes and differences from other similar modes.

 

Category

Design PatternsThe book originally divided the design pattern into the creation pattern, the structure pattern, and the behavior pattern. describe them through the concepts of authorization, aggregation, and diagnosis. to learn more about the background of object-oriented design, refer to interface mode and cohesion. to learn more about the background of object-oriented programming, refer to inheritance, interfaces, and polymorphism.

Mode name Description InDesign Patterns InCode Daquan[1]
Creation Mode
Abstract Factory Model Provides a unified creation interface for a product family. When you need a series of products of this product family, you can select the corresponding series from the abstract factory to create a specific factory class. Yes Yes
Factory method mode Define an interface to create an object, but let the subclass decide which class to initialize. The factory method puts the initialization of a class into the subclass. Yes Yes
Generator Mode Separates the construction of a complex object from its representation, so that different representations can be created during the same construction process. Yes No
Lazy initialization Mode Deferred object creation, data computing, and other operations that require a large amount of resources, only executed during the first access. No No
Object pool Mode The high cost of obtaining and releasing resources is avoided by recycling the exploitation objects. No No
Prototype Use a prototype instance to specify the type of the object to be created, and copy the prototype to create a new object. Yes No
Singleton Mode Make sure that a class has only one instance and provides global access to the instance. Yes Yes
Structural Mode
Adapter Mode Converts an interface of a class to another interface that the client expects. The adapter mode can eliminate Class compatibility problems caused by interface mismatch. Yes Yes
Bridging Mode Decouples an abstraction and implementation so that the two can change independently. Yes Yes
Combination Mode Multiple objects are structured in a tree to represent the local and the whole, so that users can treat the combination of a single object and an object in the same way. Yes Yes
Modifier Mode Dynamically add more functions to an object. The modifier mode is a method that extends functions except class inheritance. Yes Yes
Appearance Mode Provides a consistent interface for a group of interfaces in the subsystem. The appearance mode defines a high-level interface, which makes the subsystem easier to use. Yes Yes
Meta Mode Through sharing, we can effectively support a large number of small particle objects. Yes No
Proxy Mode Provide a proxy for other objects to control access to this object. Yes No
Behavior mode
Responsibility Chain Model To cancel the coupling between the request sender and receiver, multiple objects have the opportunity to process the request. Connect these objects into a chain and pass the request along the chain until an object processes it. Yes No
Command mode Encapsulate a request as an object so that you can parameterize the customer with different requests, queue requests or record request logs, and support cancelable operations. Yes No
Interpreter Mode Given a language, it defines a syntax expression and an interpreter that uses this representation to interpret sentences in the language. Yes No
Iterator Mode Provides a method to access each element in an aggregate object sequentially without exposing the internal representation of the object. Yes Yes
Mediator Define an object that encapsulates how a set of Objects interact. mediator promotes loose coupling by keeping objects from referring to each other explicitly, and it lets you vary their interaction independently. Yes No
Memorandum Mode Without violating encapsulation, capture and externalize an object's internal state so that the object can be restored to this State later. Yes No
Observer Mode Define a one-to-many relationship between objects. When an object changes state, all other related objects are notified and automatically refreshed. Yes Yes
Status Mode Allow an object to alter its behavior when its internal state changes. The object will appear to change its class. Yes No
Rule Mode Define an algorithm series, package them separately, and make them interactive. The policy mode allows the algorithm to be changed independently when used by users. Yes Yes
Specification Recombinable business logic in a Boolean fashion No No
Template Method Mode Define the skeleton of an algorithm in an operation, deferring some steps to subclasses. template method lets subclasses redefine certain steps of

Algorithm without changing the algorithm's structure.

Yes Yes
Visitor Mode Represent an operation to be performed med on the elements of an object structure. Visitor lets you define a new operation without changing the classes of

Elements on which it operates.

Yes No
Single-serving visitor Optimize the implementation of a visitor that is allocated, used only once, and then deleted No No
Hierarchical visitor Provide a way to visit every node in a hierarchical data structure such as a tree. No No
Concurrency Mode
Active Object   No No
Balking   No No
Double checked locking   No No
Guarded   No No
Leaders/followers   No No
Monitor object   No No
Read Write lock   No No
Scheduler   No No
Thread Pool Mode   No No
Thread-specific storage   No No
Reactor   No No
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.