Software Engineering | factory method pattern

Source: Internet
Author: User

A factory Object usually contains one or more methods to create various types of objects that can be created by the factory. These methods may receive parameters to specify the object creation method and return the created object.

Sometimes, the control process of a specific type of object is more complex than simply creating an object. In this case, factory objects will be used. A factory object may dynamically create a product object class, return an object from the object pool, perform complex configuration on the created object, or apply other operations.

These types of objects are useful. Several different design patterns apply the factory concept and can be used in many languages. For example, in design patterns, factory method patterns, abstract factory patterns, generator patterns, and even Singleton patterns all apply the concept of factories.

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.