A simple factory is a special case of the factory method model.
The main difference between the factory method mode and the abstract factory mode is the degree of abstraction of the factory.
In the abstract factory model, the factory interface is abstracted to indicate that it is a factory, and no matter what product it creates, it has a high degree of abstraction.
The abstract factory of the factory method mode is generally aimed at product abstraction, indicating that it is a factory that produces certain types of products.
A simple factory does not support inheritance. If too many objects need to be created, this class will become larger and the build-up coupling will be concentrated on this class.
The factory method solves the disadvantages that simple factories do not support inheritance.
The objects created in the preceding two modes are in a hierarchical structure.
Abstract Factory is oriented to multiple parallel hierarchical structures. The object creation principle is to divide the objects to be created in units of clusters (similar objects.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service