C # object-oriented design mode lecture 6: Prototype prototype (Creation Mode)

Source: Internet
Author: User

(According to the msdn webcast courses)

Dependency inversion principle:

Abstraction should not depend on implementation details, but on abstraction. Implementation Details are often changeable.

Abstract A directly depends on implementation details B:

Abstract A depends on abstract B, and implementation B depends on abstract B:

Prototype Design Pattern: it often faces the construction of some complex objects with complex structures. Due to the changes in requirements, these objects also face drastic changes. We need to isolate these variable objects so that object changes do not affect customersProgramCall these objects.

Gof: Uses prototype instances to batch create object types. By copying these prototypes, you can create new objects.

When the objects used change frequently, the users and specific objects of the class objects are isolated and the variable classes must have stable interfaces.

For example, create a prototype of a specific object for the client program to call:

It is easier to clone or serialize classes.

<End>

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.