Design pattern mind map

Design pattern mind map

What are design patterns

  • Design patterns are proven, widely accepted, reusable solutions to specific problems in software design.

Classification of design patterns

  • creational pattern
    • Singleton pattern
    • Factory method pattern
    • abstract factory pattern
    • builder pattern
    • Prototype pattern
  • structural pattern
    • adapter mode
    • bridge mode
    • Combination mode
    • decorator pattern
    • appearance mode
    • Flyweight mode
    • proxy mode
  • behavioral patterns
    • template method pattern
    • command mode
    • iterator pattern
    • Observer pattern
    • intermediary pattern
    • Memo mode
    • interpreter mode
    • state mode
    • strategy pattern
    • chain of responsibility model
    • visitor mode

creational pattern

  • Singleton pattern: ensures that a class has only one instance and provides a global access point.
  • Factory method pattern: defines the interface for creating objects, and the subclass decides which class to instantiate.
  • Abstract Factory Pattern: Provides an interface for creating a series of related or interdependent objects without specifying their concrete classes.
  • Builder pattern: Separates the construction of a complex object from its representation, so that the same construction process can create different representations.
  • Prototype Pattern: Create new objects by copying existing objects rather than instantiating them.

structural pattern

  • Adapter pattern: Converts the interface of a class into another interface that the client expects.
  • Bridge pattern: Separates the abstract part from its implementation part so that they can both change independently.
  • Combine mode: Combine objects into a tree structure to represent a "part-whole" hierarchy.
  • Decorator Pattern: Dynamically adds additional responsibilities to an object and is an alternative to inheritance.
  • Facade pattern: Provides a simplified interface to complex subsystems.
  • Flyweight pattern: effectively supports a large number of fine-grained objects through sharing technology.
  • Proxy pattern: Provides a proxy for other objects to control access to this object.

behavioral patterns

  • Template method pattern: Define the skeleton of an algorithm in operation and defer some steps to subclasses.
  • Command pattern: Encapsulates a request into an object, allowing you to parameterize the client with different requests.
  • Iterator pattern: Provides a way to access individual elements in a container object without exposing the object's internal representation.
  • Observer pattern: defines a one-to-many dependency relationship between objects. When the state of an object changes, all objects that depend on it will be notified and automatically updated.
  • Mediator pattern: Use a mediator object to encapsulate a series of object interactions.
  • Memento pattern: Capture the internal state of an object and save this state outside the object without destroying encapsulation.
  • Interpreter pattern: Given a language, define a representation of its grammar, and define an interpreter that interprets sentences in the language.
  • State Pattern: Allows an object to change its behavior when its internal state changes.
  • Strategy pattern: Define a series of algorithms, encapsulate each algorithm, and make them interchangeable.
  • Chain of Responsibility Pattern: Decouples the sender and receiver of a request so that multiple objects have a chance to handle the request until one of the objects handles it.
  • Visitor pattern: represents an operation that acts on each element in an object structure. It allows you to define new operations that act on these elements without changing the class of each element.

The above are common design patterns, which are widely used in software design. By rationally using design patterns, you can improve the readability, maintainability, and scalability of your code, reduce the writing of duplicate codes, and improve software development efficiency.

Guess you like

Origin blog.csdn.net/u010100877/article/details/131783717