iOS design mode-generator mode

Source: Internet
Author: User

First, the definition

    • Generator pattern: Separates the construction of a complex object from its performance, allowing the same process to create different manifestations.
    • The builder pattern includes two important roles: Mentor and generator
    • The instructor knows how to build the product without knowing that certain information is missing.

Second, the use of generators

    • You need to create complex objects that involve various parts. The algorithm that creates the object should be independent of the Assembly method of the part.
    • The build process needs to build objects in different ways

Iii. Comparison of generators and abstract factories

Generator Abstract Factory
1 Building Complex objects Building complex or abstract objects
2 Building objects in multiple steps Building objects in a single step
3 Building objects in multiple ways Building objects in a single way
4 Return the product in the final step of the build process Return to Product now
5 Focus on a specific product Emphasize a set of products

iOS design mode-generator mode

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.