Abstract factories can create multiple product class objects, such as a root dish and a stem dish in a vegetable plant. Factory mode and abstract Factory mode and simple factory model only when the specific application, the analysis of the specific product level, and then select the appropriate design pattern.
And in the not a level, vegetable workers are not the same object of concern, in the simple factory model, workers want to grow radish or cabbage, in Factory mode, workers think of planting roots or stems, and in the abstract Factory mode, is concerned about the planting of genetic or non-genetic dishes
Summary
★ Factory mode, the important thing is the factory class, not the product class. Product classes can be in many forms, multiple layers of inheritance, or a single class are all possible. But to be clear, the factory-mode interface will only return an instance of a type, which should be noted when designing a product class, preferably with a parent class or an interface that is implemented together.
★ Using Factory mode, the returned instance must have been created by the factory and not taken from other objects.
★ Factory Mode The returned instance can not be newly created, and it is also possible to return the instance created by the factory.
Difference
Simple factory: Used to produce any product in the same grade structure. (inability to add new products)
Factory method: Used to produce fixed products in the same grade structure. (Support for adding any product)
Abstract Factory: Used to produce all products of different product families. (for adding new products, powerless; Support for adding product families)
Design mode: Agent.
A picture of a text editor.
Available in front-end UI loading
The principle of who uses, who judges.
Proxy mode application:
The opening and loading of the UI.
Open and then load, the data section and the display section are separated.
The display section is not displayed when the resource is loaded, but the data can be updated.
When the load is complete, go to refresh the display.
Observer pattern
Note that a reference causes a garbage collection mechanism and the class cannot be recycled.
When LISTITEM is using observer mode, it is best not to live new ListItem.
Push mode, Pull mode.
Update before the data is updated, or update after the data is updated. To maintain consistency.
March 1, 2015 11:39:28 design mode