See nuggets of 30 days even more challenge, want to try oneself in the end can persist in a few days, the prize is not the prize is not important, focus on participation? In the next 30 days, I will take you to study design patterns. I used to think that design patterns were very complex and rarely used in general programming. After reading them carefully, I found how ignorant my previous ideas were. If a programmer wants to improve themselves and make themselves more valuable, then code specifications, design patterns and other technical knowledge points need to be understood and mastered.

In fact, we use design patterns more or less in our daily development, but we don’t know much about them. For example, we often use singleton pattern, factory pattern, etc.

The author is mainly engaged in C# development, the code in the program uses C# for example.

Overview of design patterns

(Abstraction, Encapsulation, Inheritance, Polymorphism) are the basic concepts of OO, OO principles are our goal, and design patterns are our practice.

There are a total of 23 design patterns, which can be divided into three categories from the perspective of large structures, namely, creation pattern, structural pattern and behavior pattern.

Creation pattern

These patterns are a mechanism for creating objects that improve the flexibility and usability of existing code.

  • The factory method
  • The abstract factory
  • The generator
  • The prototype
  • The singleton

    Structural model

    Describes how to assemble objects and classes into larger structures while keeping the structure flexible and efficient.

  • The adapter
  • The bridge
  • combination
  • decoration
  • appearance
  • The flyweight
  • The agent

    Behavior patterns

    These patterns are responsible for efficient communication between objects and delegation of responsibilities.

  • Chain of responsibility
  • The command
  • The iterator
  • broker
  • The memo
  • The observer
  • state
  • strategy
  • Template method
  • The visitor

    If all you have is a hammer, everything looks like a nail. So we have to try to have multiple hammers in our hands.

The most basic, low-level patterns are often referred to as idiomatic techniques, and they are generally only available in one programming language.

The most general, high-level patterns are the architectural patterns, which we can use in any programming language, but unlike other patterns, they can be used for the architectural design of the entire application.

Small remarks

A person’s struggle, like pregnancy, a long time, will always be seen.

Life is short, and I don’t want to go for what I can’t see, I just want to catch what I can see.

I am zai say, thank you for reading, if you help, trouble thumb up, forward thank you.