The purpose of the design pattern
In the process of writing software, programmers face many challenges from coupling, cohesion, maintainability, extensibility, reuse, flexibility and so on. Design patterns to make the program have better
1. Code reuse (i.e., code of the same function is not written multiple times)
2. Readability (i.e., normative programming to make it easier for programmers to understand code)
3. Scalability (i.e. very convenient when new features need to be added, called maintainable)
4. Reliability (that is, when we add new functions, the original functions will not be affected)
5. Make programmers present cohesive, low-coupling characteristics
Seven principles of design patterns
1. Principle of single responsibility
2. Interface isolation principle
3. Dependency inversion principle
4. Richter’s substitution principle
5. Open and Close Principle (OCP)
Demeter’s Rule
7. Principle of composite reuse
Where are design patterns reflected in software
Object-oriented (OO) –> Functional module [Design pattern + Algorithm (data structure)]–> Framework [Using multiple design patterns]–> Architecture [Server cluster]
Questions you might be asked in an interview
1. What design patterns have you used
2. How is it used
3. What problem was solved
Share the quotes
To quote Scott Mayers in his excellent book Effective C++, “the difference between a C++ expert and a C++ novice is that they have scars on the back of their hands.” It means that a good programmer has to tread many holes and suffer many injuries to grow. Design patterns are the lessons learned in the development process, so learning to use design patterns can enable a novice programmer to develop business efficiently
Next link (Java Design Pattern Study Notes – Single Responsibility Principle) :
https://juejin.cn/post/6844903950185922574