As you continue to try to discover new features in your applications, do you find that the solutions you propose are so similar to some things you have implemented before? If you're a programmer (even if you've only been starting out for a short time), you probably answered "yes." It looks like you are using some old code to solve newly discovered problems during software development. You may have realized that your solution is a fundamental principle, a method that can be widely repeated not only by you but by all professional developers.
In fact, many programming problems are encountered repeatedly, and many basic methods (or design patterns) for solving these problems have emerged. A design pattern is a template that teaches you how to organize your code using authentic and reliable designs.
Design pattern history
The term "design pattern" was originally coined in the field of architecture. In his 1977 book "A Pattern Language: Towns/Building/Construction", Christopher Alexander describes some common architectural design problems and explains how to use a collection of existing, well-known patterns to start new and effective designs. . Alexander's perspective translates well to software development, and there is a long-term consensus on using existing components to construct new solutions.
All design patterns have some common characteristics: a name, a problem statement, and a solution.
1. The identification of a design pattern is important because it allows other programmers to immediately understand the purpose of your code without having to study too deeply (at least through this identification, programmers will be familiar with this pattern). ?
2. The problem description is used to illustrate the application field of this model. ?
3. The solution describes the execution of this model. A good discussion of a design pattern should cover the advantages and disadvantages of using the model. ?
Expand