What is a design pattern: The software crisis in the 1960s has enabled people to pay attention to the research of software engineering. At first, people focus on software design on the selection of data structures and algorithms. With the size of the software system, it is more and more complex, and the structure and specifications of the entire system are more important. In the face of increasingly complex software systems, people have begun to realize that software productivity and quality needed to realize software industry development, software reuse is a practical way.
The design pattern is first referred to by architecture designer Christopher Alexander in the A Pattern Language: Towns, Buildings, Construction (Oxford University Press, 1977).
He introduced this concept and called a pattern - an abstract solution that repeated design issues - this concept attracted some of the attention of some researchers in other fields, especially in the middle and late 1980s, those development Software personnel of the object.
Christopher Alexander pointed out in his book: "Every pattern describes a problem that has been repeated around us, as well as the core of the solution. In this way, you can use the scheme again and again without having to repeat labor"
The in-line designer knows: not to solve any problems, you have to start with your head. They are more willing to reuse the previously used solutions. When you find a good solution, they will be used over and over again. These experiences are part of their way.
Novelists and script writers rarely start designing plots. They always follow some models that have existing models, like the "Tragic Hero" model ("Mike White", "Hamlet", "Romantic Novel" model (there is countless romantic novel).
In 1995, "Design Pattern" (China Translation "design mode") has been admired, and it is a groundbreaking work for the use mode method in object-oriented programming. This book has repeatedly appearing in software practices, but the essence of features and solutions is summarized, and 23 representative modes are extracted.
The design pattern is not a specific "technology", it tells the idea. It not only shows the flexible applications and wisdom of interface or abstract classes in practical cases, but also allows developers to truly master interfaces or abstract classes. More importantly, the purpose of these design patterns refined to emphasize the purpose of trying to improve the usage rate, allowing the program to reuse as possible.
The design pattern is a useful tool for object-oriented design. 1. The mode provides a solution that solves a problem in a certain environment. 2. The mode acquires experienced designers' experience in a system, and makes it a design instrument and learning tool that is not professional. 3. Mode category As the term glossary, help understand the public, but complex design issues.
Delivery design pattern
SLR Design Mode: Take a certain method to ensure that there is only one object instance for a class, and this class only provides a method of acquiring its object instance. (P113) Example: We designed a clock class and asked to keep only only one clock object in the program. This program is not alone. That is, if only one person can remember to instantiate the clock class once, but because there are many partner common to implement this program, it must be designed to ensure its implementation from the program. So how do you do it?