Design mode (Factory mode 1)

Source: Internet
Author: User

Factory mode -- Implementing separation of the creator and caller of the class

Detailed classification:

* Simple Factory mode

* Factory Method mode

* Abstract Factory mode
The basic principles of object-oriented design:


(1) If you have two classes and want to add new functionality, it is best to add new classes instead of modifying the original classes.

(2) If two implementation classes, a is a concrete implementation class, B is also an implementation class,

A-->b,a depends on B, but if B implements an interface, we directly and the interface

Do not have sex with the implementation class. Dependency is shifted from concrete to abstract.

(3). Our class has less to do with other classes, that is, to rely less on other classes,

  


  

Design mode (Factory mode 1)

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.