23 design modes of MM and Java [turn]

zhaozj2021-02-16  117

http://www.chinaunix.net Author: Oriental Spider Posted: 2004-03-06 11:49:23

I saw this article in the Java Forum, with a relaxed language to more than 32 models of Java, have a good inspiration, but unfortunately, I have not given specific meaning, I will add it behind. These are the easiest introductions. If you want to learn, I suggest you look at Dr. Yan Hong's "Java and Mode" book. [B: 9CECA65206] Created mode [/ b: 9ceca65206] 1, Factory- chasing MM can not eat, McDonald's chicken wings and KFC's wings are what MM love to eat, although the taste is different, but no matter you MM went to McDonald's or KFC, and only said to the waiter "to come four chicken wings". McDonald's and KFC is the Factory factory model for producing chicken wings: customer class and factory class separate. Consumers need some kind of product at any time, just request the factory. Consumers can accept new products without modification. The disadvantage is that when the product is modified, the factory class must make a corresponding revision. Such as: How to create and how to provide it to the client. 2, Builder-MM's favorite listening is "I love you" this sentence, see MM of different places, you must use their dialect to tell her this sentence, I have a variety of language translator, Each language has a button. When I see MM, I can use the corresponding key. It can use the corresponding language to say "I love you" this sentence, the foreign mm can also make it easy, this is me "I love you" builder. (This is a better selling machine for the US military in Iraq.) Construction mode: Separate the internal representation of the product and the generation process of the product, thereby generating a product object with different internal representations. The construction model makes the internal representation of the product can change independently, and customers do not have to know the details of the internal composition of the product. Construction mode can enforce the construction process of a sub-step. 3, Factory Method - Please go to McDonald's to eat burger, different mm has different tastes, you have to remember is an annoying thing, I usually use the Factory Method mode, with MM to waiter, say " A burger, what kind of burger is the specific burger, let MM say directly to the waiter. Factory Mode: The core factory is no longer responsible for the creation of all products, but will give the specific created work to the subclass, become an abstract factory role, only responsible for the interface that must be implemented, not contact Which product class should be instantiated. 4, prototype, chat with MM, must say some affection, I have collected a lot of meat love words, when you need COPY, you will go in QQ, this is my love. Prototype. (100 yuan, do you want) Original model mode: By giving a prototype object to specify the type of object to be created, then create more types of objects with a copy of this prototype object. The original model mode allows the dynamic to increase or decrease the product class, and the product class does not require any level of prior defined, the original model mode applies to any level structure. The disadvantage is that every class must be equipped with a cloning method. 5, Singleton - I have 6 beautiful wife, their husband is me, I am the husband sigleton in our family, as long as they say "husband", they all refer to the same person, that is, I have just a dream. Oh, which is such a good thing) single case mode: Single-case mode Make sure that a class has only one instance, and it is instantiated and supplied to the entire system. Single example mode should only be used when there is a real "single instance".

[B: 9CECA65206] Structural mode [/ b: 9ceca65206] 6, Adapter - I met a beautiful Sarah in a friend party, from Hong Kong, I won't speak Cantonese, she won't speak Mandarin, I have to help me. Friend Kent, he as an adapter between me and sarah, let me talk to each other (nor do you know that he will play me) Adapter (Transformer) mode: Transform a class into the client Another interface that is expected to make two classes that were originally working together due to mismatch due to interface reasons. The adaptation class can return a suitable instance to the client based on the parameter. 7, Bridge- I met MM in the morning, I have to say good morning, I have encountered MM in the evening, I have to say good evening; I have to wear new clothes, I want to say that your clothes are so beautiful, I've encountered MM new hairstyle, To say your hair is so beautiful. Don't ask me "I have a new MM to say" how to say "," I don't have a bridge mode with Bridge combination: the abstraction and implementation, so that the two can change independently, that is It is said that combining / polymerization relationships between the abstract and implementation of a software system rather than inheritance is referred to as a combination / polymerization relationship between the abstraction and implementation of a software system, so that the two can change independently. 8, Composite-Mary has a birthday today. "I have a birthday, you have to send me a gift." "Well, ok, go to the store, you will pick it." "This T-shirt is very beautiful, bought, this dress is good, buy, this package is also good, I bought it. "" Hey, I bought three pieces, I only promised to send a gift. "" What, T-shirt plus skirt plus bag, just match a set, Miss, trouble you. " "...", MM will use the Composite mode, have you? Synthesis mode: The synthesis mode will be organized into the tree structure and can be used to describe the overall relationship between the overall and part. The synthesis mode is a mode of processing a tree structure of an object. The synthesis pattern expressed the structure of the part and the entire relationship. The synthesis pattern allows the client to treat a separate component object and synthetic objects composed by them. 9, Decorator-Mary overtime to SARLY birthday, still don't tell her to pick it up, otherwise this month's food fees will definitely have finished playing, take out the photos I took photos in Huashan last year, and write "the best The gift is to love your fita. "After buying a gift shop to the street (the mm of selling gifts is also very beautiful), then find a beautiful box to put it up ..., We are all Decorator, and eventually modify me this person, how do you understand? Decorative mode: Decorative mode to extend the function of the object in a transparent manner, is an alternative to inheritance relationships, providing more flexibility than inheriting. Dynamically give an object increasing function, which can be revoked again. Increase a very large number of functions generated by some basic functions. 10, Facade - I have a professional Nikon camera, I like it yourself to adjust the aperture, the shutter, this photo is special, but MM does not understand these, and I will not teach for a long time. Fortunately, the camera has a FACADE design mode, adjust the camera to the automatic file, as long as the target is on the shutter, everything is automatically adjusted by the camera so that MM can also take this camera to take pictures. Facade mode: Communication with an external and a subsystem must be performed through a unified facade object.

The facade model provides a high-level interface that makes the subsystem easier to use. Each subsystem has only one facade class, and this facade class has only one instance, that is, it is a single case mode. But the entire system can have multiple facade classes. 11, Flyweight- Send a text message with MM every day, the fingers are exhausted, recently bought a new mobile phone, can put some common sentences, when you want to use, take it out, add MM's name You can send it, no longer use a word one word. The shared sentence is Flyweight, the name of the mm is the external feature extracted, according to the context. Enjoying Yuan Mode: Flyweight refers to the most exclusive level in the boxing competition. Enjoying Yuan mode is efficiently supported by sharing to support a large number of fine granular objects. The key to enjoying the element can be shared is to distinguish between the intrinsic state and the external state. The inherent state is stored inside the enjoys and does not vary with the environment. The outer state is changed as the environment changes. The outer state cannot affect the intrinsic state, which is independent of each other. The state that will be shared and the state that cannot be shared is distinguished from the conventional class, and the status of the shared cannot be shared from the class. The client cannot create a shared object directly, and a factory object should be used to create a shared object. The enjoyment mode greatly reduces the number of objects in memory. 12, proxy - chat with MM online, one start "Hi, Hello", "Where did you come?" "How old?" "How much is it?" These words, it is really annoyed, write a program As my proxy, all have the answer to these words, set the automatic answer, and let me know if you receive other words, how to answer, cool. Proxy mode: Agent mode provides a proxy object to an object and controls the reference to the source object by the proxy object. The agent is a person or a body represents another person or an institution. In some cases, customers don't want to directly reference an object, and the agent object can directly play directly to the intermediary directly. The client does not have a proxy topic object with the real subject object. The proxy model can do not know the true subject object, but only one interface of the agent object, at this time, the agent object cannot be created by the agent object, and the other role that must be available in the system is created and incorporated. [B: 9CECA65206] Pattern [/ B: 9Ceca65206] 13, Chain of Responsibleity - go to the English lesson at night, in order to open the last row, wow, take a few beautiful MMs, find a paper Bar, write "Hi, can you be my girlfriend? If you don't want to send forward", the note is passed by a pick, bad, passing to the first row of MM to pass the paper to the teacher. I heard that it is an old woman, run! Responsible chain mode: In the responsible chain mode, many objects are picked up by each object to form a chain. Requests on this chain until an object on the chain decides to handle this request. Customers don't know which object on the chain finally processes this request, and the system can reorganize the chain and assignment responsibility without affecting the client. There are two options: responsibility or push the responsibility to the next home. A request can eventually be accepted by any receiving end object. 14, Command - I have a MM home to manage very strict, I can't meet, I have to use her younger brother to transfer information between us, what is her instruction to me, write a note to bring me brother? . This is not, her brother passed another Command. In order to thank him, I invited him to eat a bowl of soy sauce, and where he said: "I will send my sister three boyfriend to Command, as you have the minimum gas, Please eat face.

", Command Mode: Command Mode Package a request or operation into an object. Command mode Put the responsibility of the issued command and the responsibility of the execution command, delegate to different objects. Command mode allows the party to be requested to be independent Open, so that one of the requests does not have to know the interface to receive the request, it is not necessary to know how the request is received and whether the operation is executed, when is executed, and how to execute. System support command. 15, Interpreter - There is a "Bubble MM Truth", there are all kinds of MM's Raiders, such as the steps to eat Western food, go to the movie method, etc., as long as the MM, as long as it is an interpreter, take the top The script is executed. Interpreter mode: After a language is given, the interpreter mode can define a representation of its grammar, and provide an interpreter. The client can use this interpreter to explain the sentence in this language. The interpreter mode will describe how to explain these statements when there is a simple grammatist. The language mentioned in the interpreter mode means any combination of any interpreter object. Need in the interpreter mode Define a grade structure of a representative's order class, which is a series of combined rules. Each command object has an interpretation method that represents any interpretation of the command object. Any arrangement of objects in the level structure of the command object is A language. 16, Iterator - I love Mary, regardless of everything to marry her. Mary: "I want to marry you, I have to promise my condition" I: "What conditions I agree, you said" Mary : "I look at the diamond" I: "I bought, I bought, and?" "Mary:" I look at the villa by the lake "I:" I bought, I bought, is there? "Mary:" I look at the Ferrari sports car "my head is awkward, sitting on the chair, a bit bite:" I bought, I bought, is there? "... Iterative Submatical: Iterative Submatics can sequentially access a condensed element without exposing the internal representation of the aggregated internal representation. The overall number of multiple objects is formed together, and the aggregation target is a container that can be incompatible with a set of objects. Object. Iterative Submathes encapsulate iteration logic into a separate sub-object, which is separated from the aggregate itself. Iterative sub-mode simplifies the interface of the aggregation. Each aggregate object can have one or more iterative sub-objects, each An iterative iterative state can be independent of each other. The iterative algorithm can be independent of the gathering role change. 17, Mediator - four mm play mahjong, who should give each other, how much is it, fortunately, I am next According to the individual chip count, earn money from me, pay for money, pay for money, everything is OK, I got four MM phone. Turning person mode: the mediation mode package A series of objects interacts such that these objects do not have to make each other. Thus, they can loose coupling. When the role between some objects changes, it will not affect the role between other objects, guarantee these The role can be independent of each other. The stopper mode converts multiple interactions into a pair of interactions. Mediationer mode will abstract the behavior of the object and collaborate, put the object in small scale behavior with other objects The interaction is separated. 18, MEMENTO, when chatting with a few MM, must remember what I just said with MM, otherwise MM discovers will not be happy, fortunately, I have a memo, which MM just now Say what I have copied in a memo, so you can always look at the previous record. Memo mode: Memo mode is a snapshot of a snapshot used to store another object's internal state.

The purpose of the memo mode is to catch the state of an object without damaging the package, and is external, stored, so that this object can be restored to the stored state when appropriate. 19, Observer - want to know the latest MM intelligence of our company? Joined the company's MM intelligence mail group, Tom is responsible for collecting information, and the new information he discovers does not need to notify us, directly released to the mail group, we can receive information in time as a subscriber (observer) : The observer model defines a team of multi-dependent relationships, let multiple observer objects simultaneously listen to a topic object. When this topic is changed, all observer objects will be notified to enable them to automatically update themselves. 20, State - When interested with MM, be sure to pay attention to her state. Her behavior will be different in different states. For example, you will go to watch movies this evening, and MM, which is not interested, will say "there is Things, "I don't hate it, but I haven't liked MM" good, but can I bring my colleague? ", I have already said that you will say" What time? After watching the movie How about going to the bubble? ", Of course, you can see a good performance during the movie, or you can never like to become like it. Status mode: The status mode allows an object to change behavior when its internal state changes. This object looks like a class that changes it. Status mode Pack the behavior of the objects in different status objects, each state object belongs to a subclass of an abstract state class. The intent of the state mode is to make an object change in its internal state change. The status mode requires a subclass of a status class for each system possible. When the status of the system changes, the system changes the selected subclass. 21, Strategy - Dating with different types of MM, to use different strategies, some, please make a movie better, some, eat the snack effect, some go to the seaside romance, single goal is to get MM's Fang Xin I have a lot of strategy in my chasing mm kit. Policy Mode: Policy mode For a set of algorithms, each algorithm is encapsulated into an independent class with a common interface, so that they can be replaced with each other. The policy mode makes the algorithm can change without affecting the client. Strategy mode separates behavior and the environment. Environmental class is responsible for maintaining and querying behavioral classes, and various algorithms are provided in specific policy classes. Due to the algorithm and the environment independently open, the algorithm is increased or decreased, and the modifications will not affect the environment and client. 22, Template Method - Have you seen this classic article "How to convince girls to go to bed"? Girls have divided the constant steps to the unchanging steps, break the deadlock, launch pursuit, kissing, ava play, hands, caress, go in Template Method, but each step is different, there is different situations. The practice, this is to see you randomly strain (specific implementation); template method mode: Template method mode Prepare an abstract class, implement partial logic in the form of a specific method and concrete structure, then declare some abstract method to force subclasses Realize the remaining logic. Different subclasses can implement these abstraction methods in different ways, thereby different implementations of the remaining logic. A top logical framework is first developed, and the details of the logic will be made to the specific subclass.

23, Visitor - Valentine's Day, give each MM to send a bunch of flowers and a card, but each MM sent to the characteristics of her personal characteristics, each card should also pick it according to the characteristics of the individual, I A person is clear, or find a flower shop owner and gift shop owner to do Visitor, let the flower shop boss choose a bunch of flowers according to MM, so that the gift shop owner also chooses a card according to each person, so it is easy More; visitor mode: The purpose of the visitor mode is to encapsulate some operations applied to a certain data structure element. Once these operations need to be modified, the data structure that accepts this operation can remain unchanged. The visitor mode is applied to a system that is relatively unstuten data structure, which relieves the coupling between the data structure and the operation of the structure, so that the set of operations can evolve relatively free. The visitor model makes it easy to increase the new operation, add a new visitor class. The visitor mode sets the relevant behavior into an accessor object rather than scattered into a node class in one. When using the visitor mode, you should put as many objects as possible in the visitor class, not in its subclass. The visitor mode can accepted a member class that belongs to different level structures across several levels of hierarchy. Dancing with basketball,

- Take this to the Department of Physics, China University of Science and Technology 01, 2 shots

== Creation mode ==

1, = Simple factory = I have been tired of playing basketball, just having a small stall on the side. "Come to Coke." "I want Fena." "A bottle of mineral water."

Factory model: Customer class and factory class separate. Consumers need some kind of product at any time, just request the factory. Consumers can accept new products without modification. With a small stall, our thirsty problem is very easy solution.

2, = factory method = I have been in the afternoon, I will take a shower, come back and take a shower, and the canteen is closed. We ran over the West three doors outside to eat beef noodles (huh, one of life), every restaurant's flavor is still different, this does not matter, we just say a "bowl of beef noodles".

Factory Mode: The core factory is no longer responsible for the creation of all products, but will give the specific created work to the subclass, become an abstract factory role, only responsible for the interface that must be implemented, not contact Which product class should be instantiated. Every restaurant is a specific factory, but now the West Sanmen has turned off, depressed ing!

3, = singleton = kobe is Kobe, whether you see from TV, or see it from the newspaper, in fact, he is alone.

Single-case mode: Single-case mode Make sure that a certain class has only one instance, and it is instantiated and supplied to the entire system. There are a few, but Kobe can only have one, nonsense!

4, = builder = NBA Zhongqiang team is quite, and each has its own characteristics, so there is a different play for different teams, but you just say "Today, the king" will, how to make a coach to arrange (Build)

Construction mode: The internal representation and client of the product come, the customer does not have to know the details of the internal composition of the product, so the appearance of the product is generally used very complicated. The tactical arrangement is indeed a professional task, so ....

5, = prototype = This year, all star games are true, I really want to see it again. "Xiao Chen, open the Serv-U, I will under your all-star game." "OK! But upload two good films." "Ah, I halo ~~!"

Original model mode: actually copying. The original model mode allows dynamics to increase or reduce product classes, and the product class is suitable for any level structure. The disadvantage is that every class must be equipped with a cloning method. Fortunately, Dongdong inside Windows has a copy option. == Structure mode ==

6, = adapter = When Yao Ming is going to the rocket, the exchange is a bit inconvenient, but through the broker Adapter, Yao Ming quickly mixed with the rocket.

Adapter mode: Transforms a class into another interface to the client, so that two classes that have been worked for by interface reasons and cannot work together. Through the broker Adapter, the head coach can regard Yao Ming as the local people (people who speak E text). Now Yao Ming has strengthened the function, making it do not want to communicate with the head coach, huh, Str Man!

7, = composite = The first half was filled with 50:25, and the middle field was suspended. Let's arrange how to hit the second half: "Solution A: No. 6 is too accurate, you have to guard against it." - "That is!" Solution B: The left defense is too weak, change the XX. "-" Good Yeah! "" Solution C: Attack is too bad, play some differences. "-" Not bad! "Scene D: first half Solution X is actually good, the second half go on. "-" Okok! "... a whistle, the second half begins, we will combine scheme A, B, C ..., set as program Y. @ # ¥% ^ & * (! ~ Waiting for a series, we finally overcome the opponent at 51:50, haha ​​... !! Daydream # & @ *!

Synthetic mode: The synthesis pattern allows the client to treat individual components objects and synthesis objects composed by them, so synthesis mode makes it easy to add new components to the client. Scheme A is a simple solution, and the program D is a complex scheme that is combined by different plans, but we only know that they are what we want.

8, = Decorator = Remember that the West side playground did not repair, we kicked the ball without the land, okay, a basketball court is empty, we have a few bricks, put two doors, haha, this, basketball court It turns into a small football field. A dance will be held in the system, you have to find a big place, we look at the basketball court, hang a lamp, move two speakers, OK, everything is done. In this way, the basketball court turned into a dance hall, haha.

Decorative mode: Decorative mode to extend the function of the object in a transparent manner, is an alternative to inheritance relationships, providing more flexibility than inheriting. In fact, basketball court can also become a lot of other stuff, just play your imagination, hehe.

9, = proxy = Play NBA Positive Happying. Suddenly, Xiao Fu ran over and said, "Your phone, X-system say you have to do it with our two pm, how?" - "" - "OK, I have no problem with them!" Play Games. The small payment fails to save a lot of things, huh, huh.

Agent mode: Agency is a person or a body to take action on behalf of another person or an institution. In some cases, customers don't want to directly reference an object, and the agent object can directly play directly to the intermediary directly. The client does not have a proxy topic object with the real subject object. The proxy model can do not know the true subject object, but only one interface of the agent object, at this time, the agent object cannot be created by the agent object, and the other role that must be available in the system is created and incorporated. The X system only knows that we agree with them, but they don't know if they answer them. 10, = flyweight = Last time I said to eat beef noodles, there are a few very picky. This is not: "Boss, I want to spicy." - "Good!" Hey, the boss put some spicy sauce. "I want to sinate." - "Ok!" Hey, the boss put some pickles. "I also want to be Sichuan." - The boss did it again in the style of just now. Xiao Chen watched everyone, I didn't accept it, I said: "The boss, I want to black." "What is black?" The boss wondered. "Black, black is more than some soy sauce ..." - The whole game is mad # & *%

Enjoyment Yuan Mode: Enjoying Yuan Mode Highly to support a large number of fine-grained objects efficiently. The key to the sharing element can be shared is that its state is stored inside the enjoys, and does not vary with the environment. The status of the regular class can be shared from the conventional classes, and the state that cannot be shared from the class is removed from the class. When the client gets an object from the factory, the factory will check if it has this object, and if it is, it will return to the customer directly, and no new instance is created. The enjoyment mode greatly reduces the number of objects in memory. Those spicy, Sichuan flavors are all enjoyed, there are many beef noodles, but the taste is so much. Later, we played basketball and went to the store. I haven't waited for Xiao Chen, the boss said: "This classmate, you are a black beef noodles." - Xiao Chen ... "

11, = facade = Also started with the X-based season, the specific time and place have to rely on this captain to get it, good, no problem! A call for the X-series basketball team captain: "3:00 am on Saturday, we have seen it high."

Facade mode: The facade mode provides a high-level interface that makes the subsystem easier to use, it separates the client and some subsystems to improve the independence and portability of the subsystem. The X-series basketball team captain is a Facade, through him, lest I am going to notify them by a team member (subsystem).

12, = Bridge = I am a student, but in the basketball team, I am a player, then what do you say, Super Saiyan? Ha ha.

Bridge mode: Differentialization of abstraction and implementation make the two can change independently, that is, the strong correlation between them becomes weakly associated, that is, refers to the abstraction and implementation of a software system. The combination / polymeric relationship is used instead of inheritance, so that both can change independently. Haha, thanks to this model, or I really don't know what to call me, 嘻嘻.

== behavioral mode ==

13, = Strategy = There are many tactics in football, for example, in general, 442, can use 451, weakened teams can use 343. Of course, there are also basketballs. For example, you can choose to make a center, or far vote, of course, we usually use the most useful, haha. Policy Mode: Policy mode For a set of algorithms, each algorithm is encapsulated into an independent class with a common interface, so that they can be replaced with each other. The policy mode makes the algorithm can change without affecting the client. Strategy mode separates behavior and the environment. Environmental class is responsible for maintaining and querying behavioral classes, and various algorithms are provided in specific policy classes. Due to the algorithm and the environment independently open, the algorithm is increased or decreased, and the modifications will not affect the environment and client.

14, = Template Method = Different basketball classes have different teachers, but they are the same, generally divided into drums, pass, shoot, lay baskets, and estimates the teaching of sports teachers. The template is like this. How can I teach in the specific municipality, how to teach it in the back, according to different teachers.

Template Method: Template Method Preparations an abstract class to achieve partial logic in the form of a specific method and a concrete structure, then declare some abstract methods to force subclasses to achieve the remaining logic. Different subclasses can implement these abstraction methods in different ways, thereby different implementations of the remaining logic. A top logical framework is first developed, and the details of the logic will be made to the specific subclass.

15, = observer = "Take the basketball this afternoon." - a "Good, call me." -B "is also called me." -C "also has me." - D ... our class Chambel, huh, huh, huh.

Observer mode: The observer mode makes the observer and the coupling between the observer, and the observer will issue notices to all registered observes. When A is going to play basketball, it will notify B, C, D ...

16, = iTerator = Big basketball lesson, sports teacher wants to be famous: "Xiao Wang (Sports Committee), how many people do you have to class?" Xiao Wang: " , 4, ... "

Iterative Submount: Iterative Submount can sequentially access a gathering element without exposing the gathered internal appearance. Iterative Submatings encapsulate iteration logic into a separate sub-object to separate from the aggregate itself. The iterative sub-mode simplifies the interface of the aggregation. Each of the aggregated objects can have one or more iterative sub-objects, each iterative state of each iterative, can be independent of each other. The iterative algorithm can be independent of the aggregated role. Xiao Wang is really smart, you don't have to query anyone know how many people have.

17, = CHAIN ​​of Responsibleity = Now the Lakers attack, Pedon handed the ball to Malong, Malone passed to O'Neill, O'Neill's rebate, the Lake people added 2 points.

Responsible Chain Mode: In the liability chain mode, many objects are connected by each object to the reference to which they will form a chain. Requests on this chain until an object on the chain decides to handle this request. Customers don't know which object on the chain finally processes this request, and the system can reorganize the chain and assignment responsibility without affecting the client. There are two options: responsibility or push the responsibility to the next home. A request can eventually be accepted by any receiving end object. In fact, the ball just now, O'Neill can pass to Kobe to come to an air relay, the wind bus, then Perfect!

18, = Command = a key game last second by the three points determined to win, but it can be tired. "Come to the glass." I heard, my classmate A is called a mm, MM, I poured a glass of water. "Be sour." I heard, my classmate A immediately called the mm to give me a hammer. "I really want to take a shower." I really listen ... ", I am not that, wow ... ^ ¥ & *." Command mode: Command mode package a request or operation into an object. Command mode The responsibility of the issued command and the responsibility of executing commands are separated, and delegate different objects. The command pattern allows the request to be opened independently, so that one of the requests does not have to know the interface to receive the request, it is not necessary to know how the request is received, and when is executed, when is executed, how to be executed of. If you know how to execute that order, you will not say that sentence, hey ...

19, = memento = I have a NBA game, which can be automatically switched automatically, but to change the registry, of course, first find the key value "final", right, export to final.reg, then you can change it casually , In case it is wrong, you can also double click Final.reg, huh, huh.

Memo mode: Memorandum object is an object that is used to store a snapshot of another object's internal state. The purpose of the memo mode is to catch the status of an object without damaging the package, and separated from the object, stored, so that this object is restored to the stored state.

20, State Today, playing is really hard, shooting old. Suddenly, one mm came over ... Ah -, the third order of the super-race, transform! After turning into the incident, there is different, and there are two people who have easy-to-hand, and they will take a hand in three people's pentals. (Oh, you will blow)

Status mode: The status mode allows an object to change behavior when its internal state changes. This object looks like a class that changes it. The status mode requires a subclass of a status class for each system possible. When the status of the system changes, the system actually changes the selected subclass. This mode can be considered when an object behavior relies on its state. When MM didn't come, the status is poor, causing the shot committee.靓 MM is coming, the status is beautiful, it is to play, haha.

21, = Visitor = The next semester basketball class has been replaced by a teacher. Of course, he is completely unfamiliar, so the first class, he took a roster to find the sports committee Xiao Wang: "How is Xiao Chen technology?" - "Generally "" Little Luo? "-" OK, but can't go it. "" What about? "-" He ah ... ", etc., I have a cough. "How did he?" - "He, he is not bad!" Haha. "It is a shot old commission!" - Ah, you are small, play me.

Visitor mode: The purpose of the visitor mode is to encapsulate some operations that apply to some data structural elements, making it easy to add new operations, once these operations need to be modified, the data structure accepting this operation can remain unchanged. For example, the teacher can also get the height of each of us through Xiao Wang. The visitor pattern can accepted a member class (more than the generation) that belongs to several classs, but it is difficult to add a new node. If we come to a new classmate, small The king will not use it. 22, = interpreter = I want to know how to play a cool fake action, I have the classic highlights of And1 here, according to the above practice.

Interpreter mode: After a given language, the interpreter mode can define a representation of its grammar and provide an interpreter. The client can use this interpreter to explain the sentence in this language. The interpreter mode will describe how to use the mode design to explain these statements when there is a simple grammatist. The language mentioned in the interpreter mode means any combination of any interpreter object. In the interpreter mode, you need to define a level structure of a command class that represents a text method, that is, a series of combined rules. Each command object has an interpretation method that represents an explanation of the command object. Any arrangement combination of objects in the level of command objects is a language.

23, = mediator = 俺 A high school classmate small D to me, of course, playing is essential. Calling Xiao Wang goes out of K others, but small D and Xiao Wang are not criticized, so there is almost no cooperation, and the result is 5: 0 in CAI. I have to "rest" in the end. Xiao Wang: "Telling your classmates less, more pass." - "OK." I passed the opinion to small D. Small D: "Your classmate is defensive, you have to keep people, don't focus on the ball." - "No problem." I passed the opinion to Xiao Wang again.

Turpler mode: The mediation mode is packaged in a series of objects to interact, so that these objects do not have to make each other. This allows them to loose coupling. When the role between some objects changes, there is no immediate impact on other objects. Ensure that these roles can be different from each other. The mediation mode converts multiple interactions into a pair of interactions. The mediation mode is abstracted by the behavior of the object and collaboration, and the object is separated from the interaction of other objects in small scales. Sure enough, I rely on me this Mediator, we also have an opponent's egg. Haha!

Reference: << Chasing MM and Design Model >> << Java and Model >> Welcome to the point.

转载请注明原文地址:https://www.9cbs.com/read-14562.html

New Post(0)