In the past, I only had a rough understanding of the design pattern, but not many of them were actually used,
Now it's time for the system to learn about the design model,
This is the next higher level after the object-oriented knowledge!
For designing a software system, if object-oriented is the weapon of design, then the design mode is the weapon of use!
A software system using an appropriate design model has good reusability, scalability, and maintainability!
Benefits of learning Design Patterns:
Master reusable and high-quality solutions;
Facilitate internal communication between teams;
Analyze and solve problems from a higher perspective;
Judge whether there is a correct design, not just a workable design;
ImprovementCodeCan be modified;
Promote the selection of improved designs, even when the design model is not explicitly used;
Find an alternative to the "huge inheritance system.
Facade appearance Mode, Usage reason:
Some features of a complex system can be encapsulated to simplify its use.
Hides a system and does not directly expose it to users.
Tracking the use of a system
Changing the functions of a system on the original basis
Write a new simple and easy-to-use system, so that everyone can learn a complex system.
For example, a dummies camera automatically adjusts various parameters in one-click photo packaging,
The new operation encapsulates operations such as memory application and object initialization,
The new operator trace object is reloaded to detect memory leakage.
Adapter Mode, Usage reason:
Change the existing object interface to another interface to facilitate the use of other classes.
Adds the existing object interface function to upgrade the existing object to facilitate the use of other classes.
Example: power transformers and simultaneous interpretation.