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