Reprinted-oop design mode in Flash

Source: Internet
Author: User
Tags sendmsg xml parser
Design Mode of OOP in Flash
Someone asked me how to write the flash as. I could tell him responsibly how to write it, because the composition mode of the AS and flash determines its high degree of liberalization. Theoretically, you can use the button's on event, plus stop (), play (), gotoandstop (), and gotoandplay () to implement most of the logical relationships in flash. Source code Easy to understand. But most people will not do this because this method is really admirable. A little common sense Program Members will know the difference between the face object and the face process. Although flash programming only appears in the form of scripts, it is still not perfect. For example, there is not much inheritance, but it has initially reflected the idea of OOP. This article Article Now I will summarize the design patterns of objects in flash and some self-developed ideas.

The design model is an American architect (also an information engineer, painter, mechanical engineer... ) Christian. alexander proposed it first and was soon promoted by software technicians, become one of the supreme laws in software engineering (if you are interested, you can look at his book "The Eternal path of architecture", and I believe it will benefit a lot ). Simply put, it is based on the face of objects, including the face of objects, the whole part of the design is modeled, hierarchical, fine-grained, highly reusable, decentralized, and humanized. The Supremacy principle is based on the demand. That is to say, no matter what you do, the human needs should be put first, and whether the entire system is reasonable enough from this perspective. This course is very interesting, especially in flash, and can be applied to many interesting instances. Below I will follow some general design patterns, for example, if there are any errors, please correct them:

1. Abstract Factory)
There are a lot of food in the canteen, and I just want to eat the same thing. The concept of canteen is an abstract factory for me. Every window can be seen as a specific implementation. What I want to do is, go to the canteen, find the window, and buy what I want from the window.

For example, The Flash front-end interacts with the ASP back-end to access a dynamic page and extract the required data from the database. The common practice is to parse the dataset into an XML string in the back-end, and then send it to SWF. The data structure retrieved by each business logic module, that is, the XML structure, is different. We need to parse the corresponding XML string for each specific business logic, convert to an array that can be displayed. You also need to convert the text input in flash into an XML string and submit it to the background.

Abstractfactory.
// Abstract Factory Interface
Interface abstractfactory {
// Generate the specific implementation of the XML parsing Factory
Function createxmlparsefactory ();
}

Xmlparsergetfactory.
// Generate a factory for the XML object to be parsed and read in
Class xmlparsergetfactory implements abstractfactory .{
VaR xmlparser;
Function xmlparsergetfactory (STR: string ){
// The specific implementation of the generator will be mentioned later
}
Function createxmlparser (){
Return xmlparser;
}
}
Xmlparserpostfactory.
// The factory that generates the XML object for parsing output
Class xmlparserpostfactory implements abstractfactory .{
VaR xmlparser;
Function xmlparserpostfactory (STR: string ){
// Generate the specific implementation of the parser
}
Function createxmlparser (){
Return xmlparser;
}
}

In this way, when we read an XML string, add

// Generate the factory for resolving the message board's message list
VaR xmlparser = new xmlparsergetfactory ("xmlparseguestbooklist ")
Xmlparser = xmlparsergetfactory. createxmlparser ()

Note: Abstract Factory mode is one of the most common design modes in software engineering. The implementation process is that when a class instance is required, it is created through a factory instead of directly creating it. Frankly speaking, it increases the development workload, but it is of great help to achieve hierarchical program change scores and reduce coupling.

 

2. Builder Mode)
In other words, I want to go to the corresponding canteen window when I want to eat something, but I cannot eat the canteen window. There may be a lot of things in the window. I want to tell the teacher to ask for this, and this.

For example, if I have already created a factory for the XML Parser and want to return it to the parser itself, let the factory create and return it to me.

Xmlparsergetfactory.
// Generate a factory for the XML object to be parsed and read in
Class xmlparsergetfactory implements abstractfactory .{
VaR xmlparser;
Function xmlparsergetfactory (STR: string ){
// If the message board list parser is required,
If (STR = "xmlparseguestbooklist "){
Xmlparser = new xmlparserguestbooklist ();
}
}
Function createxmlparser (){
// Return the required parser
Return xmlparser;
}
}

 

Abstractxmlparser.
// Abstract XML Parser
Interface abstractxmlparser {
Function parsexml ();
}
Xmlparserguestbooklist.
// Message board list parser
Class xmlparserguestbooklist implements abstractxmlparser {
// Parse the content in the XML string into a bunch of Arrays
Function parsexml (XML: XML, arrayid: array, arraytitle: array ){
// Specific cyclic Operation
}
}

When using:

VaR xmlparser = new xmlparsergetfactory ("xmlparseguestbooklist ")
Xmlparser = xmlparsergetfactory. createxmlparser (XML, arrayid, arraytitle );

 

3. Factory method)
When I arrived at the canteen window, I couldn't eat anything if the master smoked with me. I said, Cook! The master will complete the meal. This is the factory method mode. Abstract Factory implementation is usually done in the factory method mode.

For example, the previous one was used to implement the specific XML Parser by adding a parameter in one sentence. However, the constructor does not return a value, so it must be used.
Xmlparser = xmlparsergetfactory. createxmlparser (XML, arrayid, arraytitle );
.

Note: The Abstract Factory mode requires flexible application of the generator mode and factory method mode.

 

4. Singleton)
I bought a huge chicken leg by myself. I said I needed one too, said the master.

For example, the single-piece mode is widely used. It ensures that each instance is created only once globally, and most of the MC in Flash is single-piece. The Core Components in the kernel are only a single piece, for example, my message ing list (see later ).
According to the strict definition of the single-piece mode, the class should be responsible for saving its unique instance. However, I can't think of how to implement this in flash, or what it means, but we can also do this by providing only the unique access point of this object globally. This can be done by means of hierarchies. The specific access implementation of this object is encapsulated in the lower layer and only a unique access point is provided to the upper layer (the reason is that, the upper layer does not know the specific information of this single piece, such as the path ).
Check part of my kernel file:

Core.
// Kernel
Class core {
VaR strucglobalparam: configvariables;
// Site information
VaR xmlconfig: XML;
// XML Object of Site Information
VaR arraystructureinitial: array;
// Array provided to the loadobject object
VaR arrayforbtn: array;
// Array used to initialize the navigation bar component
VaR objinitial: loadobject;
// Read the object of the video.
VaR objmessagemap: messagemap;
// Message ing component
......
}

This is the data structure of my kernel class, that is, the core class of the whole site. The data is only directly accessed through the basicmovie, originalfunctionobject, and other classes (see the following section.

Note: The core idea is to ensure only one.

 

 

5. Prototype)
Go to the stir-fry window and check whether the fried green peppers look good. "Master, I want to do the same ."

For example, this is not familiar to flash users. We often use duplicatemovieclip () and
Attachmovie () functions. Copy instances according to a prototype and perform their own actions. In my blog list, the navigation bar is generated .. A prototype is used almost to obtain multiple pieces of data.

 

6. Responsibility Chain Model
7. intermediary Mode
8. Observer Mode
The farthest window in the kitchen in the dining room didn't boil cabbage. Please tell the kitchen to deliver it.
Responsibility Chain Mode: A window and a window are passed to the canteen, and the canteen is not good at reading it. Please send it to us as soon as possible.
Intermediary mode: Send a message to a specific person. If there is no food in any window, the person needs to rush to the kitchen.
Observer mode: the kitchen is staring at each other. When the window is out of food, the system begins to shout.

For example, the reason why we put these three design patterns together is that I have built a fun thing in my website, which is the core of my website. It solves the communication problem of MC in my flash.
For example, to notify video B to start playing after video A is finished, write the relative path from A to B or the absolute path of B at the last frame of video, let B play (). In this way, the coupling between A and B is quite high, that is, the degree of mutual dependency is too high. The solution using the design pattern is as follows:

Messagemap.
// Message ing Class
Class messagemap extends object {
VaR message: string;
VaR messagewatcher: function;
VaR target;
VaR messagelist: array;
VaR num_msg: number;
Function messagemap (){
Num_msg = 0;
Messagelist = new array ();
Message = "hang_up ";
Messagewatcher = function (prop, oldvar, newvar, Param ){
For (VAR I = 0; I <num_msg + 1; I ++ ){
If (newvar = messagelist [I] [0]) {
Messagelist [I] [1]. Apply (messagelist [I] [3], messagelist [I] [2]);
If (! Messagelist [I] [4]) {
Messagelist. splice (I, 1 );
Num_msg --;
I-= 1;
}
}
}

};
This. Watch ("message", messagewatcher, "test ");
}
Function sendmessage (MSG: String, MC: movieclip ){
Message = MSG;
}
Function updatemessagemap (MSG: String, objfunction: function, arrayparam: array, objrefer, ismultiused: Boolean ){
Messagelist [num_msg] = new array ();
Messagelist [num_msg] [0] = new string ();
Messagelist [num_msg] [0] = MSG;
Messagelist [num_msg] [1] = new function ();
Messagelist [num_msg] [1] = objfunction;
Messagelist [num_msg] [2] = new array ();
Messagelist [num_msg] [2] = arrayparam;
Messagelist [num_msg] [3] = objrefer;
Messagelist [num_msg] [4] = ismultiused;
Num_msg ++;
}
Function deletemessagemap (objrefer ){
For (VAR I = 0; I <num_msg; I ++ ){
If (messagelist [I] [2] = objrefer ){
Messagelist. splice (I, 1 );
Num_msg --;
}
}
}
}

Class subtemplatemovie extends basemovie {
VaR movieremovefunction: function;
Function subtemplatemovie (){
This. Stop ();
Moviestartfunction = function (){
Lock ();
This. Play ();
};
Movieendfunction = function (){
Lock ();
This. Play ();
};

Movieremovefunction = function (){
This. Stop ();
Sendmsg ("sub_template_removed", this );
_ Parent. unloadmovie ();
};
Moviemainfunction = function (){
Stop ();
Sendmsg ("sub_template_open", this );
};
Updatemessage ("loading_bar_over", moviestartfunction, null, this, false );
Updatemessage ("back_to_index", movieendfunction, null, this, false );
}
}

The mechanism is that the video submits a Data Structure in advance and declares that if a video submits the message, this function is executed. The principle is that when a message is sent, a value is assigned to a variable mapped to the message. Because the message ing inherits from the object class, you can use the watch method to monitor the variable, check in the submitted message ing list. If yes, run the corresponding function. In fact, this also results in a certain degree of coupling, but we have successfully controlled the coupling in the lower-level class, and the upper-level subclass does not need to care about the implementation process of this message mechanism.

This mechanism allows us to have a deeper view of the true purpose of OOP. For example, when video a finishes playing the video, it declares that it is finished. As for what you want to do when I finish playing the video, it is not my business. I don't control you. The so-called reducing coupling degree is a relative concept. Don't forget that at the bottom of the computer, the coupling degree is the same, and the CPU is always directly or indirectly addressable, but what we need to do is, change the topological structure of the system and control the coupling degree within a certain range.

The entire message ing Class is equivalent to an intermediary, and an internal observer is generated. Once a message is triggered, it is executed in the form of a responsibility chain.

 

 

9. Bridge)
The food is too light and does not suit some people's appetite. Therefore, the canteen's master is required to open a window to add more chilies to the prepared food.

I used the Bridging Mode in my own website: All films inherit the self-defined basicmovie class (basicmovie inherited from the movieclip class), but in the films of the four lower-level columns, the same methods and events need to be defined to respond to messages. basicmovie does not have these functions and does not meet the requirements. It is silly to write them all in four films, I wrote another subtemplatemovie class inherited from basemovie, which added some common methods, and then all the four lower-level template films inherited from it, which greatly simplifies later development.

Basicmovie.
// Base Film
/The original class of all films and the parent class of all films inherit this class
Class basemovie extends movieclip {
VaR islocked: Boolean;
// Starts the function of the initial class.
VaR moviestartfunction: function;
// Function of the initial class video master
VaR moviemainfunction: function;
// Function of the initial class ending video
VaR movieendfunction: function;
VaR globalparam
// Initial class Constructor
Function basemovie (){
}
//

// Send a message
Function sendmsg (MSG: String, MC: movieclip ){
_ Root. objcore. objmessagemap. sendmessage (MSG, MC );
}
// Add message ing
Function updatemessage (MSG: String, msgmapfunction: function, arrayparam, OBJ, ismultiused ){
_ Root. objcore. objmessagemap. updatemessagemap (MSG, msgmapfunction, arrayparam, OBJ, ismultiused );
}
// Delete message ing
Function deletemessage (OBJ ){
_ Root. objcore. objmessagemap. deletemessagemap (OBJ );
}
Function getglobalparam (){
Globalparam = _ root. objcore. strucglobalparam;
}
}

Subtemplatemovie.
// Lower-level template film class
Class subtemplatemovie extends basemovie {
VaR movieremovefunction: function;
Function subtemplatemovie (){
This. Stop ();
Moviestartfunction = function (){
Lock ();
This. Play ();
};
Movieendfunction = function (){
Lock ();
This. Play ();
};

Movieremovefunction = function (){
This. Stop ();
Sendmsg ("sub_template_removed", this );
_ Parent. unloadmovie ();
};
Moviemainfunction = function (){
Stop ();
Sendmsg ("sub_template_open", this );
};
Updatemessage ("loading_bar_over", moviestartfunction, null, this, false );
Updatemessage ("back_to_index", movieendfunction, null, this, false );
}
}

Note (the message ing mechanism depends on the responsibility chain mode)

 

 

10. Adapter Mode)
I want a bowl of soup, but there is only a paper lunch box, there is no spoon, so the canteen master gave me a disposable bowl and spoon, this is called an adapter.

The adapter solves the problem that the external interface of a class is not suitable, which may be caused by parameters or the type of returned values, at this time, we need to add an indirect layer between the work object and the class.
This mode is used at the underlying data exchange layer. As I said, data exchange between flash and Asp.net is based on XML. There are only three layers of returned XML at the underlying layer, including database operations, data operations, and data display. The data operation layer returns an XML string to the data display layer. Then I encountered a small problem. On the other hand, I needed to submit data to the database, which is also an XML string, however, I need XSD verification for the XML Representation of the corresponding table dataset in the database! (In one breath, I almost couldn't help myself ). That is to say, I need to retrieve at least one record in this table. The problem is that the encapsulated class never returns XML but XSD. The solution is the adapter, which creates a project and adds a layer dedicated to obtaining the XML verification format. This completes the conversion between different interfaces.

Note: The adapter and bridge are very similar. When the existing class does not meet the requirements, add an indirect element for the purpose. The difference is that the adapter solves the conversion between incompatible interfaces. Bridging generally does not involve this problem, but completes a one-to-many conversion.

11. Facade)
Every day, I want to go to the canteen. Everyone has to go to different windows to eat different dishes. I am very tired. Today, I recommend monkeys to cook in the dormitory:
You eat this, three or two meals. I eat that, five or two meals. Everyone only negotiates with the monkey. All the chefs in the canteen also see the monkey alone.

For example, this mode can be widely used in the communication between the upper and lower layers of the program. Each module of ASP processes different data and accesses different tables of the database, and processes different underlying Data Access Components. That is to say, each MC Module must know which specific data access component I want to fetch data. Each module must maintain one of its own, at least a string.
If the appearance mode is used. We can allow all MC that require data interaction to access the same ASPX page, such as getstrxml. aspx. You only need to send a identifier to notify the unique leaf that is used to retrieve data and access the lower-layer component to obtain data. The lower-layer components do not know which Mc requires data, and the MC does not know the specific data source. In this way, the upper and lower layers are not transparent to each other. This reduces the coupling degree.

 

12. Proxy)
Maybe we don't want to eat every day, so we ask the monkey to be in the dormitory at noon every day. If we want to eat, he will go. If we don't eat anything, what does he like to do.

For example, I am afraid this is a pattern that everyone will inadvertently use in flash. For example, for a website, its lower-level columns do not need to be read at the beginning of the initialization of the entire website, but we need to ensure that when the viewer wants to see and clicks a button on the navigation bar, the premise is that we must keep an index internally, which can be called a proxy. It is usually an empty Mc

 

13. Strategy)
I first find a seat in the canteen every day, then cook, then cook, and then buy a cup of yogurt. This has been modeled. If there is a waiter in the canteen, I want him to do the same.

For example, the policy mode refers to a seriesAlgorithmEncapsulate to form a class. This mode can be integrated into other modes almost anytime, anywhere. My XML parser is actually an application of the policy mode, this mode is also applied to the lower layer of my website, because the data submitted by flash to the ASPX page is also an XML string, and the lower layer module also needs the corresponding parsing algorithm. Similarly, I encapsulated XML parsing into a class.

// Resolution functions in the CS File

Class datamodel. blogmsgs {
...
Public dataset parsexml (string strxml ){
Dataset DS = new dataset ();
//.. Load XML into Dataset
Return DS
}
...
}

 

 

14. flyweight)
Not enough food? Give you 20 mirrors ~
Master, there is only one copy of things...

I am very sorry about this mode. I have not yet imagined its implementation in flash. For example, the browser's mechanism is to share one flyweight with the same letter in a large number of English documents, which occupies only one space in the memory, it is then displayed in different parts of the document, which can save a lot of resources for a large amount of fine-grained effects. I am very grateful to anyone who has thought of it.

 

15. Visitor mode (visitor)
If I want to, I can always go to the window where I want to eat, provided that I have to run this trip.

For example, I said that all my MC classes are inherited from the basicmovie class, but not all my MC classes need to obtain database data from later. Obtain the information to be accessed by the database data, such as the IP address, path, and file, which are saved in the configuration file. during initialization, the information is read into the kernel and only one copy is available in the kernel. Adding references to these global variables in basicmovie is not suitable, because only a few Mc instances are used, and for some reason I cannot use the bridge mode (I already have subtemplatemovie, so I use the visitor mode.

Basicmovie.

// Obtain global variables
Function getglobalparam (){
Globalparam = _ root. objcore. strucglobalparam;
}

If the upper-level Mc does not execute this function, it cannot obtain global variables. If it is used, it will execute.
That is to say, when necessary, I access it.

Note: declare a visit operation so that the visitor can correctly access the required class.

 

 

16. State)
I want to eat noodles today. The teacher asked me: What do I want? Tomato and eggs, pork ribs or beef?

For example, the State mode is to localize some of the current state of the object. When the object changes the state, it seems to have changed the class. The example is my scroll bar. If you want to scroll through a text box, you need to reference the scroll and maxscroll attributes of a textfield. If it is MC, it references the _ y and _ HEIGHT attributes. I use a parameter to distinguish them, controlled by an if statement, the scroll bar can freely differentiate states.
Another solution is to define different sub-classes of scrollbar, which are essentially slightly different. When there are many States, it is possible to maintain a large if algorithm, in this way, it is better to use the method of generating subclass.

Scrollbar.
// Scroll bar component
Function bindto (MC, type: String, intmcheight: Number, yinitial: Number ){
Scrolltype = type;
If (type = "TXT "){
Scrolltxt = MC;
}
If (type = "MC "){
Initialy = yinitial;
Mcheight = intmcheight;
Scrollmc = MC;
}
}
Function scroll (){
If (scrolltype = "TXT ")
This. onenterframe = function (){
Scrolltxt. Scroll = scrolltxt. maxscroll * mcblock. _ y/(bglength-blocklength * 3/2)
};
If (scrolltype = "MC "){
This. onenterframe = function (){
If (scrollmc. _ height> mcheight ){
Scrollmc. _ y = initialy-(scrollmc. _ height-mcheight) * mcblock. _ y/(bglength-blocklength * 3/2 )}
}
}
}

Note: This is also a common mode, which is especially common in the logic control of flash.

 

 

17. decorator)
How can I eat without chopsticks in the canteen? I never bring a basin. The master is very user-friendly. Every window contains chopsticks, which can be used with you.

If this mode is used properly, it can be effort-saving in some places. For example, the scroll bar in my website:

Scrollbar.
// Scroll bar component
Class scrollbar extends basemovie {
VaR bglength: number;
VaR blocklength: number;
VaR mcblock: movieclip
VaR width: number;
VaR scrolltype;
VaR scrolltxt: textfield;
VaR scrollmc: movieclip;
VaR mcheight: Number
VaR initialy: Number
Function scrollbar (){
}
Function initialscrollbar (bglength, blocklength ){
This. blocklength = blocklength;
This. bglength = bglength;
}
Function bindto (MC, type: String, intmcheight: Number, yinitial: Number ){
Scrolltype = type;
If (type = "TXT "){
Scrolltxt = MC;
}
If (type = "MC "){
Initialy = yinitial;
Mcheight = intmcheight;
Scrollmc = MC;
}
}
Function scroll (){
If (scrolltype = "TXT ")
This. onenterframe = function (){
Scrolltxt. Scroll = scrolltxt. maxscroll * mcblock. _ y/(bglength-blocklength * 3/2)
};
If (scrolltype = "MC "){
This. onenterframe = function (){
If (scrollmc. _ height> mcheight ){
Scrollmc. _ y = initialy-(scrollmc. _ height-mcheight) * mcblock. _ y/(bglength-blocklength * 3/2 )}
}
}
}
Function scrollmc (){

}
Function stopscroll (){
This. onenterframe = NULL;
}
Function reset (){
Mcblock. _ y = 0;
}
}

The core function is bindto (). You can scroll by binding the instance of this scroll bar to a dynamic text box or a MC.

Note: The idea of the decoration mode is to add responsibilities to a single object dynamically and transparently without affecting other objects.

 

 

18. Composite)
I have six or two meals at noon, pork stew vermicelli, spicy chicken, fish balls, salted duck eggs, and two cups of yogurt (pig !)
These things are all objects, and they make up my lunch together.

For example, it should be said that the combination mode is everywhere in flash, because as long as there is MC nesting, There is a combination mode. Several Mc packages are packed in one MC. The loaded MC is called a container.
But in this case, I am afraid no one will pay attention to this mode, because we are using it if we don't manage it or understand it. He does have many implementation methods. One of my methods is like this.

// Blog.
My blog
Class blog extends basemovie {
// The first page of the blog, including the diary list, calendar, and recent message
VaR mcbloglist: mcbloglist;
// The second page of the blog, including the full text of the diary, reply, and comment on the diary.
VaR mcblogdairy: movieclip;
VaR currentstate: string;
VaR currentdairyid: number;
Function blog (){
}
}

Mcbloglist.
// First blog page
Class mcbloglist extends basemovie {
// Recent message
VaR recentmsgs: blogmsgssc;
// Diary list
VaR bloglist: bloglist;
// Calendar
VaR calendar: calenderforblog;

}
Mcblogdairy.
// Second blog page
Class mcblogdairy extends basemovie {
// Full log display
VaR blogdairy: blogdairy;
// Message board
VaR guestbook: bloginputmsg;
// Display the message list
VaR blogmsgs: blogmsgs;
}

Each component in it also contains other components, such as the scroll bar and dynamic text box. What I want to say is, the MC nesting mode I wrote in as does not necessarily conform to the specific physical nesting mode in the FLA file. There are many decorative Mc files that do not need to be included, and there are also many specific reasons, you need to rewrite the path. For example, in blogdairy, the actual path of the scroll bar is blogdairy. mc1.scrollbar. If it is not made into blogdairy. scrollbar, it may be because I need an mc1 animation or another specific reason. However, we can add a sentence to the timeline of mc1.
_ Parent. scrollbar = This. scrollbar
Rewrite the path to the desired mode. scrollbar is a direct member of blogdairy. In addition, I don't have a statement to initialize MC. I am used to setting Mc linkage in the library.

Note: although the combination mode is essential to everyone, we can come up with more, better, and more flexible implementations.

 

 

19. Memento)
~ Master, the chicken legs are not fresh at noon at night.
~ Nonsense! This is noon.

For example, the above two statements are not the intention of the memorandum model. In fact, I cannot figure out what the memorandum looks like in the canteen. The memorandum means that the current state of the object is saved without damaging the encapsulation type of the object. When necessary, the State is restored or extracted.

The memorandum is widely used in logical relationships. It seems to be the only time-related model I have mentioned. It can involve a causal System in the control theory. The memo is widely used. The most common is the browser or website's back-up function. It is returned to the previous interface, but it is not used in my website because my website is a tree-like topology, each topic can only enter or return to the main interface from the main interface. For those sites with a mesh topology, each topic can access any other topic. This function is probably required, the implementation method is to maintain a stack-type array.

Another thing I want to achieve is to automatically record the website. For some reason, I have not added it to the website for the moment. It is easy to monitor each step of the viewer's operations, in which column, how long it has been stopped, and what it has done. If it leaves, when visiting the website next time, let him choose whether to directly access the interface he browsed last time (for example, he did not finish reading the novel he wrote last time ). This can be achieved through mongodobject, that is, the cookie in flash.

Note: The implementation of the memorandum is still very demanding. Do not destroy the object encapsulation when extracting the object state. The ideal memorandum, as an object, requires two excuses. One is for the manager, who does not know the state encapsulated in the Memorandum. Instead, the ideal memorandum is responsible for handing over the state to the desired object, and the other is left to the original object, the original user can only understand and operate the State encapsulated in the memorandum, and cannot perform other operations.

 

Summary:
I will add this article at any time. However, some examples I want to give have been completed for the moment. In fact, there are far more than these design patterns. There are 23 classic models and 41 are known to me, but there are only 19 types, as well as command mode, interpreter mode, and iterator mode, I did not write the template method mode. I have also used some design patterns that I have not mentioned and I have not considered. However, listing them one by one is actually of little significance. What interested comrades should do is to get in touch with the details and thoughts of these design patterns and forget them all. Then, they will learn Taijiquan with Zhang Wuji, the same is true after learning. The trick is to look at it. To learn it, you must understand its depth, flexibility, place of creation, and mutual integration. You cannot stick to the trick, or use the trick to use the trick. As an important part of UML, design patterns can greatly promote our development efficiency, enable us to develop good writing habits, make us more human, more harmonious, and clearer, works with higher reusability and controllability.
Do not say that you are not a programmer. You can follow your feelings and do whatever you want. Of course, we have no right to interfere. I also said that it is your freedom to write as much as you want. Not to mention that you are engaged in art, and your mind is sensitive and not suitable for such contact. The reason why I want to take the canteen as an example is to explain, what I want to talk about is Mr. Christian Alexander's permanent path of building, whether it is the building itself, any software engineering, or flash as, or even flash Vector Plotting, artist, graphic design, to the whole of the world, does not follow a structured, composed of the eternal path of the model, has an astonishing height of communication and similarity. After learning about this, we will not only have a new view on flash, but also our whole life. The difference is that you can start from flash here.

Summary: it is well written. Check it out.

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.