A brief introduction to the creation mode of the Novice design mode series notes

Source: Internet
Author: User

Design pattern is the best explanation of the "package Change" method

Whether it's creating patterns, structured patterns, or behavioral patterns, the bottom line is to look for "changes" that might exist in the software, and then encapsulate them in an abstract way.

Because the abstraction does not have a concrete implementation, it represents an infinite possibility, making it possible to extend it.

The classic design pattern is to look for possible changes in the software and encapsulate these changes.

Encapsulation Common understanding: The data (attributes) and the operation of the data (methods) into a program unit (class), so that the concept of relevant data and operations in the programming language related; Correct understanding: Information hiding-hidden details, the hidden details of the object, the hidden of the concrete implementation of the abstract concept of design/ Realize the hidden details. The key to encapsulation: reasonable concealment and openness. Purpose of encapsulation: encapsulation of the implementation

The Create pattern (creational pattern) abstracts the instantiation process of a class, separating object creation from the use of objects in the software module.

There are two types of creation modes:

(1) class creation mode: The class's creation pattern uses inheritance relationships to defer the creation of classes to subclasses, encapsulating what specific classes the client will receive, and hiding how instances of these classes are created and put together.

(2) object creation mode: Dynamically delegating the creation of objects to other objects, dynamically determining which instances of specific classes the client will get, and how instances of these classes are created and grouped together.

Creation mode provides the greatest flexibility for software designers in terms of what they create, who creates them, and when they are created.

The Create pattern hides the creation details of instances of classes, by hiding how objects are created and grouped together to achieve the purpose of making the whole system independent.


Factory mode:

The factory model is dedicated to instantiating a large number of classes with common interfaces

Factory mode dynamically determines which class to instantiate, without having to know in advance which class to instantiate each time.


There are three types of factory models:

Simple Factory mode Factory, static factory method mode

Factory method Mode factory, Polymorphic Factory mode

Abstract Factory mode abstraction Factory, Toolbox mode

Introduction to the creation mode of the rookie design mode series of notes

Related Article

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.