Concept, Composition and Classification of Design Patterns

Disclaimer: This article is a study note for blogger Liu Wei (LoveLion) design pattern column. If you are interested, I recommend you to read his column.
   Column guidance article address: https://blog.csdn.net/LoveLion/article/details/17517213?spm=1001.2014.3001.5502

1. The concept of design pattern : Design pattern is a reasonable and effective solution to some recurring software design problems in the software development process.

Concepts of Patterns and Software Patterns:

  • A pattern is a set of successful or effective solutions to a certain class of recurring problems that people have in a particular context.
    A pattern is a successful or efficient solution to a recurring problem within a context
  • A software pattern is a reasonable and effective solution to some recurring problems in the software development process.

2. GoF (Gang of four): Gang of four, composed of four famous software engineering scholars.
3. GoF introduced the concept of "pattern" into the field of software engineering, marking the birth of design patterns.
4. At each stage of the software development life cycle there are some recognized patterns.
5. The basic structure of software patterns consists of four parts, including:
(1) Problem description (what is the problem to be solved)
(2) Preconditions (under which environment or constraints are used)
(3) Solutions (how to solve)
(4) Effects (what are the advantages and disadvantages)
6. Design patterns are a set of code experiences that are repeatedly used, known to most people, and cataloged.
The use of design patterns is for reusable code, making the code easier for others to understand and ensuring code reliability.
7. The main components of design patterns include:
(1) Pattern name
(2) Problem description
(3) Solution
(4) Effect
8. Design patterns can be divided into: creational patterns, structural patterns, and behavioral patterns according to their uses .

Creational patterns: used to describe how to create objects;
structural patterns: used to describe how to realize the combination of classes or objects;
behavioral patterns: used to describe how classes or objects interact and how to assign responsibilities.

9. Design patterns can be divided into: class pattern and object pattern according to whether the pattern is used to deal with the relationship between classes or the relationship between objects .
In actual use, we will use these two classification methods in combination , for example: the singleton mode is an object creation mode.
10. There are 24 design patterns in total , including 23 design patterns of GoF and simple factory patterns. Among them, the number of creational, structural and behavioral design patterns are 6, 7 and 11 respectively .
11. For a list of 24 design patterns , you can jump to Liu Wei's blog "From moves and internal skills—an overview of design patterns (2)" for viewing.
Liu Wei: "Talking from moves and internal strength - an overview of design patterns (2)"

Guess you like

Origin blog.csdn.net/qq_43467892/article/details/125911795