The 23 design patterns of GoF(Gang of Four) will probably be a shock to anyone who likes to write software and then give each other a smile or a cold chuckle. We don’t talk about what a design pattern is, or what its benefits are, or how it’s implemented in code. We just want to share a quick overview of the names of these 23 design patterns, which are basically very graphic and easy to recognize.

A lot of people would say, well, as adults, we should be valuing understanding as opposed to the way we were when we were kids and we were holding a book and we were waving our heads and being able to memorize a lot of things that we might not understand in the morning. But we should also find out how much influence the boy’s skill had on the future. Some people write good poems, and most of them are related to reciting good words and good jokes when they were young. I think that is why children are now reading classics. Shichida mentioned in his book that what you don’t understand can turn on the interbrain circuits and so on, and the science behind that or the surreality behind that I don’t want to explain too much. This is just a brief discussion of how to memorize 23 design patterns with the simplest homonyms and associations.

In the process of practice, I often remember some valuable words like this.

1 Singleton 2 Abstract Factory 3 Builder 4 Factory Method 5 Prototype 6 Adapter 7 Bridge 8 Composite 9 Decorator 10 Facade 11 Flyweight 12 Proxy 13 Template Methed Template 14 Command 15 Interpreter mode 16 Mediator mode 17 Iterator mode 18 Observer mode 19 Chain Of Responsibility mode 20 Memento 21 State mode 22 Strategy mode 23 Visitor modeCopy the code

Okay, let’s start with two categories of the 23 design patterns:

1) Divided into three types according to the purpose: creation type, structure type, behavior type

2) Divided into two categories according to the scope: class, object

So the 23 patterns are divided into 3 by 2 equals 6 pieces, and the usual example in the book is a two-dimensional matrix, so that’s how we remember it.

A) Factory pattern (creator, class) Abstract Factory pattern (Creator, object) singleton pattern Builder pattern Prototype patternCopy the code
B) Adapter pattern (structure, class) Adapter pattern (structure, object) Proxy pattern Bridge pattern Composite pattern Decorative pattern Appearance pattern share element patternCopy the code
C) Interpreter pattern (behavior, class) Template method pattern responsibility chain pattern (behavior, object) Command pattern Mediation pattern Observer pattern iterator pattern Memo pattern Visitor pattern state pattern Policy patternCopy the code

Lonely (interpreter) Lonely (template method)

Accountability (Chain of Responsibility mode) Order (Command mode) Intermediary (intermediary mode)

Watch (observer mode) is overlapped (iterator mode) by (memo mode)

Prevent (Visitor mode) collision (Status Mode) (Strategy Mode)

Content reprint: Blog.csdn.net/u011240016/…