Singleton pattern: It is a common software design pattern, and its main purpose is to ensure that there is only one instance of a class. When only one instance of a class is needed in the whole system, singleton objects come in handy. There are three main points in the singleton object: first, a class can only have one instance; Second, it must create the whole instance by itself. Third, it must provide this instance to the whole system by itself.
Factory mode: it provides an interface for creating objects, unlike the process of creating objects publicly by the client. It uses common interface to create objects, which can be divided into three types: simple factory, factory method and abstract factory. The behavior of a class or its algorithm can be changed at runtime. This type of design pattern belongs to behavior pattern.
Strategy pattern: one of the common design patterns, it refers to defining a series of algorithms, encapsulating each algorithm and making it replaceable. Policy mode allows the algorithm to change independently of the customers who use it. In other words, define a template to solve the problem. This template is a specific strategy, and every strategy is implemented according to this template. In this case, when we have a new strategy, we can write it directly according to the template without affecting the previously defined strategy.
Facade mode: Facade mode is also called appearance mode. The definition is as follows: the communication between the outside of the subsystem and its inside must be carried out through a unified object. The facade pattern provides an advanced interface, which makes the subsystem easier to use. The facade pattern focuses on unifying objects, that is, providing interfaces to access subsystems. The facade pattern is similar to the template pattern, which encapsulates some methods that need to be repeated. However, it is different in essence. Template mode encapsulates the methods of the class itself, and its encapsulated methods can also be used alone. Facade mode is the encapsulation of subsystem, and its encapsulated interface will not be used alone in theory.