What is the design model? (1)

Source: Internet
Author: User

I. Design Pattern definition:

The design patterns (designpattern) are a summary of a set of categorized and repeatedly used software code design experiences. The design pattern is used to reuse code, make the code easier to understand, and ensure code reliability. Generally speaking, the design pattern is the basic theory of software reuse, which enables code compilation to be truly engineered.

 

Ii. design pattern classification:

The design patterns mainly include creational patterns, structural patterns, and behavioral patterns ).

 

Creation Mode: used to create objects.

Structural mode: used to build inter-class relationships.

Behavior mode: used to control the behavior of objects.

Purpose

Creation Mode
Creational Pattern

Structural Mode
Structural Patterns

Behavior mode
Behavioral Pattern

Concept

The creation mode is the object creation mode, which abstracts the instantiation process. It helps a system to create, combine, and express its objects independently. The focus is on Object creation. In the creation mode, the process of creating an object is abstracted, or the process of creating an object is encapsulated, as a customer program, you only need to use objects, instead of the logic in the object creation process.

The structural mode is designed to solve the problem of assembling existing classes and their interaction methods, so as to achieve certain functions. The structural model can solve many problems. For example: Scalability (appearance, composition, proxy, decoration) Encapsulation (adapter, bridging)

The behavior pattern involves the assignment of duties between algorithms and objects. The behavior pattern describes the patterns of objects and classes and the communication modes between them, the behavior pattern describes the complex control flows that are difficult to track when the program is running. It can be divided into behavior pattern and behavior object Pattern 1. the behavior mode uses the Inheritance Mechanism to distribute actions among classes. 2. behavior object mode uses Object aggregation to allocate behavior. Some behavior object modes describe how peer-to-peer objects collaborate to complete tasks that cannot be completed independently by any object.

Class

Factory method

Adapter (class)

Interpreter

Template Method

Object

Abstract Factory

Adapter (object)

Chain of responsibility

Builder

Bridge

Command

Prototype

Composite

Iterator

Singleton

Decorator

Mediator

Facade

Memento

Flyweight

Observer

Proxy

State

Strategy

Visitor

1. Creation Mode

Single Pattern)
Abstract Factory)
Builder Pattern)
Factory method)
Protype Pattern)

2. Structural Mode
Adapter Pattern)
Bridge pattern)
Decorator pattern)
Composite pattern)
Appearance Pattern)
Flyweight Pattern)
Proxy Pattern)

 

3. behavior mode
Template Method)
Command pattern)
Iterator Pattern)
Observer Pattern)
Mediator Pattern)
Memento Pattern)
Interpreter Pattern)
State Pattern)
Strategy Pattern)
Chain of responsibility)
Visitor pattern)

 

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.