For the same software, it may be necessary to support the operation of running in different window environments, or the same series of programs, we can use this abstract factory model, the key to the abstract factory model is the left side shown below. Part, all specific implementation portions, such as different types of interface style, etc., are included in an AbstractFactory class, and clients only deal with this class. Other specific implementations have members of this class to complete.
So this mode separates the specific class, so that we can make changes to the program, such as changes to the interface effect, because there is only one specific factory class in the program, just modify the specific factories, you can use different Product configuration. Through AbstractFactory or ConcreteFactory (because you may be in the same class as two roles, see the 62 page of the original book "62, you can achieve different specific subclasses, but there is a problem, that is These operations cannot be obtained by an abstract interface. If the mandatory type conversion can be made, although it can be converted down, it is not safe. In addition, the applicability of this mode also mentioned: When you provide a product class library, just want to display their interfaces instead of implementation. The more strange thing is that the idea of our object is to say that our pre-defined series of interfaces, only care about the interface when using it, is it not concerned? Why is it particularly proposed in an abstract factory model, isn't the other models? The above is just the experience of AbstractFactory for the first time, there must be some side and misunderstandings, I hope everyone will pointers.