God man! Use one project to explain 23 design patterns and six principles in an easy-to-understand manner.

Preface

Design patterns are divided into three categories, creation, structure and behavior. The creation type is easier to understand. It abstracts the instantiation process and decouples the system from the creation of the instance. The instance is created by a special factory, so that the system can program the abstract interface of the instance without relying on any specific implementation. Structural and behavioral types are a bit difficult to understand. GoF's explanation is that structural patterns involve how to combine classes and objects to obtain a larger structure; behavioral patterns involve the allocation of responsibilities between algorithms and objects. Behavioral patterns describe not only the patterns of objects or classes, but also the patterns of communication between them.

The characteristics of most behavioral and structural design patterns are quite obvious, but some of the boundaries are not so clear. For example, the agency model is a structural model, but it also undertakes the distribution of responsibilities. It directly processes customer requests through a proxy class, but delegates most of the actual responsibilities to the original work class. Dividing design patterns into three types can be understood as dividing a level to help users of the pattern remember and understand.

Some of the 23 design patterns mentioned by GoF are quite distinctive. They have obvious intermediate layers and are not easily confused with other design patterns, but some are not so easy to understand their intentions. The following is divided into two categories according to whether it is easy to understand to record these design patterns.

Those design patterns that are easy to understand and have obvious intermediate layers

  • One-piece mode

  • Adapter mode

  • Appearance mode

  • Flyweight model

  • Agency model

  • Command mode

  • Iterator mode

  • Strategy mode

Design patterns that are easy to confuse and have no obvious middle layer

  • Factory method and abstract factory

  • Decorative pattern

  • Combination mode

  • Observer mode

  • State mode

  • Generator mode

  • Prototype mode

  • Bridge mode

  • Chain of Responsibility Model

  • Interpreter mode

  • Intermediary model

  • Memo mode

  • Template method mode

  • Visitor mode

Just as one of the optimization criteria is "don't over-optimize", design patterns are also not to use design patterns too early and too much when the requirements are not clear. Remember several commonly used design patterns, and think about which ones are frequently changed in actual projects and which ones can be applied to these design patterns.

So how to systematically learn design patterns? I think this question must be bothering most readers and friends. The information on design patterns found on the Internet is scattered. There is no expectation to say that this article is meaningful to you. This is too demanding, I am far from This ability, but if you can have a complete set of learning videos and learning documents for you to remember this design pattern after reading it, then the goal of this article will be achieved.

Here is organized into a document, readers and friends in need can follow the editor, add assistant VX: MXW5308, you can get the [23 design patterns and six principles] document compiled by the editor and the [full set of design pattern learning videos] for free 】

The intention of this document is not only to introduce basic design pattern knowledge, but also to explain the conditions under which the correct design pattern is selected. Because in practice, misuse or misuse of design patterns is sometimes wasteful. Therefore, this document intersperses the comparison between different types of patterns in the introduction of design patterns, and gives a large number of Java problem examples in Chapter 8 and Chapter 9 for readers to understand.

Chapter 1 Overview

Chapter 2 UML Basics

Chapter 3 Introduction to Design Patterns

Chapter 4 Creative Model

Chapter 5 Structural Model

Chapter 6 Behavioral Models

Chapter 7 Concepts and Tips

Chapter 8 Design Pattern Interview Questions

Interview question and answer

Features of this book

  • Covers 23 design patterns proposed by GoF

  • Show the core ideas of design patterns in a simple and direct way

  • Cover interview questions related to design patterns

  • Provide a large number of actual code examples, and all codes are written in Java for easy debugging

  • Based on the practical experience of software developers, reduce learning misunderstandings

  • No basic knowledge of software design required

23 design patterns and six principles of learning mind map

 

A complete set of design pattern learning videos (readers and friends in need can follow the editor and add assistant VX: MXW5308 to get the [23 design patterns and six principles]] documents and [complete design pattern learning videos] compiled by the editor for free)

 

A complete set of design pattern learning videos (readers and friends in need can follow the editor and add assistant VX: MXW5308 to get the [23 design patterns and six principles]] documents and [complete design pattern learning videos] compiled by the editor for free)

Guess you like

Origin blog.csdn.net/weixin_45132238/article/details/109386427