Overview
In the software system, it often faces the creation of "a series of interdependent objects", and because of the change of the demand, more and more series objects are created. How to deal with this change? How do you bypass the normal object creation method (new) and provide a "wrapper mechanism" to avoid the tight coupling of client programs and this "multiple-series concrete object creation"? This is the abstract factory model we are talking about.
Intention
Provides an interface to create a series of related or interdependent objects without specifying their specific classes.
Model Diagram
Logical Model:
Physical Model:
Examples of life
The purpose of an abstract factory is to provide an interface to create a series of related or interdependent objects without specifying their specific classes. This model can be found in the metal stamping equipment used by the car manufacturer. This punching machine can make car body parts. The same machines are used to press the right side doors of different models, the left door, the right front fender, the left front fender and the hood, and so on. By using the runner to change the stamping disc, the specific class that the machine produces can be changed in three minutes.