1. What is the design model?

Source: Internet
Author: User
    • What is the design model?

Mode definition: mode is a solution to the problem. It is applicable to a practical environment and other bad environments.

Design Patterns are usually reusable solutions for a type of software design problems. The purpose of introducing design patterns into the software design and development processes is to make full use of existing software development experience.

There are many types of design patterns, including distributed programming patterns, user interface patterns, and data model patterns. Currently, the process's object-oriented design model is described in more than 20 categories in 1995, which we call the gof model; another important design pattern corresponding to the gof pattern is grasp ).

The GRASP mode focuses on the design principles and how to allocate class functions, while the gof mode focuses on the design implementation, Class Interaction and software quality. It has been said that the gof mode is an object-oriented design mode that meets the requirements of the GRASP mode.

The mode should have the following features:

(1) reusable in specific scenarios. The solutions are effective for environments with the same type of problems.

(2) It can be passed on, that is, there are many opportunities for problems. The solutions to the problems are the same, and people are relatively acceptable.

(3) There is a name indicating the mode.

    • Role of the Design Pattern

The design model has the following functions:

(1) reuse design, reuse design proportionCodeMore meaningful, it will automatically bring about code reuse.

(2) provide shared words for design. Each model name is a design word.ProgramCommunication between members is more convenient.

(3) using pattern words in development documents makes it easier for others to understand your thoughts, understand why you did this, and what you did. It is easier to write development documents.

(4) The application design pattern can make restructuring the system easy, ensure that the correct code is developed, and reduce the possibility of errors in the design or implementation, it also provides a good system framework for rewriting other applications.

(5) correct use of the design mode can save a lot of time.

    • GRASP mode Classification

There are no major types of GRASP General Responsibility Assignment software models. It is not so much an object-oriented design model as it is an object-oriented design requirement. There are nine models in its subdivision. The models and models are not independent and there is a balance between them:

(1) infomation expert (information expert)

(2) creator (creator)

(3) low coupling (low aggregation)

(4) High Cohesion (High Cohesion)

(5) Controller)

(6) polymorphism (polymorphism)

(7) pure fabrication (purely fictitious)

(8) indirection (indirect)

(9) protected variations (protected changes)

    • Classification of gof Design Patterns

The gof mode has different granularities and abstract layers, and the classification is obvious.

1. Classification by objective criteria

That is to say, what kind of work is done by the specified mode. There are three types:

(1) creational: it is related to object creation.

(2) structural: A combination of processing classes or objects.

(3) behavioral: describes how classes or objects interact and how responsibilities are assigned.

2. Classification Based on range criteria

That is, the specified mode is used for classes or objects. There are two types:

(1) Class Mode: it is used to deal with the relationship between classes and subclasses. These relationships are established through inheritance and are static and have been determined at compilation. In a sense, almost all models use inheritance mechanisms. Therefore, the "class mode" here refers to the mode for centralized processing of Inter-class relationships. Only a few of them belong to this type.

(2) Object Mode: it is used to process the relationships between objects. These relationships are dynamic and can be changed during running.

 

Range \ Purpose Creational) Structural (Structural) Behavioural (behavior type)
Class Simple Factory Adapter (class) Interpreter
Factory method 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

  

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.