There are 23 design patterns that you’ve never heard of, and I’m sure you’ve all heard of. As a front-end development engineer, is it necessary for us to learn and use design patterns? I personally think it is necessary.

Why study design patterns

When we write code, there are many ways to achieve a requirement, but which way has better maintainability and scalability, we need to have some ideas of design patterns, which are the wisdom left by predecessors, we should inherit it well

In addition, design mode is also an interview question, what is the factory mode, can you write an observer mode, observer mode and publish and subscribe mode is different, etc. Would it be embarrassing if you couldn’t answer

So, we must learn the design patterns, let the framework change, I am still.

How to learn design patterns

This series of articles is also the summary output of my study of design patterns. How to learn, in my opinion, is to see more and practice more. Thinking is something that needs to be accumulated. Read it twice if you don’t understand it, and practice it twice if you don’t understand it once. Quantitative change produces qualitative change, and sooner or later, at a certain point, you will be enlightened.

I hope you can join me, from the beginning, step by step to learn the design pattern, until you really master it.

Introduction to Design Patterns

Above, a list of 23 design patterns

classification

Design patterns fall into three broad categories: creative, structural, and behavioral.

  1. Creation The creation pattern encapsulates the changes in the object creation process by separating it from the object creation process

  2. Structural mode The structural mode is to encapsulate the changes of the combination mode between objects, and can flexibly express the coordination and dependence between objects

  3. Behavioral patterns are designed to isolate the ever-changing behavior of an object so that we can modify it more safely and conveniently

Design principles

Design principle is the guiding theory of design pattern, the most famous is: SOLID design principle.

  • Single Responsibility Principle
  • Opened Closed Principle
  • Liskov Substitution Principle
  • Interface Segregation Principle
  • Dependency Inversion Principle

Ah, brothers, are you familiar with, do you often hear these words from the mouth of the backend brothers, if you read the above introduction, you have this thought: this is a person’s language, I know every word, how can I not recognize it together…

That’s all right, comrades. Remember us now, learn along with me, and when you have learned all the design patterns, come back and see, if there is no accident, the toilet will open.

Why are there design patterns

Any technology is created to solve existing problems. Design patterns arise because software design is increasingly complex and changing faster and faster, constantly overturning existing code logic.

So, is there a way that we can save a little bit of effort, even though it’s still going to change, I can change it less, I can change it more flexibly, and that’s the design pattern.

Pull away and encapsulate change, constant stability, variable flexibility.

At the end

In the next chapter, we will really enter the design mode. I hope we can stick to it together and output 23 articles of some quality. Come on.

Welcome to follow my public number