Dancing with basketball,

zhaozj2021-02-16  90

== 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. @ # ¥% ^ & * (! ~ Wait for a series of series, we finally overcome the opponent at 51:50, haha ​​... !! Daydream # & @ *! Synthetic mode: synthetic model makes the client to put separate ingredients and The synthesis objects they have completed are equally, so the synthesis pattern makes the client add new components easy. Scheme A is a simple solution, and the program D is a complex plan formed by different plans, but we don't care These, we only know that they are all 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 soy sauce ..." - The whole game is mad # & *% enjoys mode: Enjoying Yuan model high efficiently supports a large number of fine-grained objects. 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, wow ... ^ ¥ & #."

Command mode: Command mode encapsulates 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 do that command, you won't say that sentence, 呜呜 ... 19, = memento = a NBA game, you can automatically switch, but to change the registration, of course, first find the key Value "Final", right button, exported to final.reg, then you can change it, in case it is wrong, you can also double click Final.reg, 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!

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

New Post(0)