7, BRIDGE: morning encounter MM, would like to say Good morning, met at MM, to say good night; encountered MM wearing new clothes, your clothes say Oh pretty good, so get a new hairstyle MM, that your hair is beautiful Oh well. Do not ask me, "MM morning when a new hair do how to say" this problem, their combination with BRIDGE on the list you do not bridge mode: the abstract and implementation of de-coupling, making the two changes can be independent, that is, that they become a strong correlation between the weak link, that is, a software system refers to the abstraction and the realization of the use of combination between / aggregation relationship instead of inheritance, so that the two can be independent of the changes.
8, COMPOSITE: Mary birthday today. "My birthday, you have to send me a gift." "Ah, well, to the shops, pick your own." "This pretty T shirt to buy, this skirt look good, buy it, this package is also good, buy. "" Hey, buy a 3 Yes, I only agreed to send a gift of Oh. "" What, T shirt bag plus plus skirt, it is a match, Miss, please wrap. " "... ...", MM will use Composite mode, you will be yet? Synthesis model: synthetic model will be organized into tree structure of objects can be used to describe the relationship between the overall and partial. Synthetic model is a tree structure to deal with the object model. Synthetic model of the relationship between part and whole tree structure used by the. Synthesis of model allows the client to a separate component objects and their synthetic compound derived from the same view object.
9, DECORATOR: Mary had finished birthday Sarly turn, or choose not to call her own, and certainly not the case this month and finish off meals, and show me the top of last year, according to the Huashan photos, write in the back of the "best The gift is love your Fita ", and then to the street to buy a gift shop Photo Frame (sold gifts Oh MM is also very beautiful), engage in art and design to find the next Mike designed a beautiful box loaded with ... ..., We are all Decorator, eventually modified my people in it, how, to understand it? Decorative pattern: decorative pattern to a transparent manner the client to expand the functions of the target is the relationship between the succession of an alternative program to provide more flexibility than inheritance. An object to increase the dynamic features that can be withdrawn dynamic. Increase the number of permutation and combination of basic functions and have a very large number of features.
10, FACADE: I have a professional Nikon camera, I would like to transfer their manual aperture, shutter, so that only according to photos from the professional, but MM can not understand them, will not be teaching for a long time. Fortunately, the camera has Facade design pattern, the camera adjusted to the autopilot, as long as targeted by the shutter on the list, all from the camera automatically adjusts, so that MM can I use this camera to shoot the photos. Window mode: the external communication with a sub-system must be unified through a window object. Window to provide a high-level interface, the subsystem easier to use. Each subsystem there is only one type of window, but this window is only one example of category, that is to say it is a single-case model. But the whole system can have more than one type of window.
11, FLYWEIGHT: send text messages every day with the MM, the fingers are exhausted, and recently bought a new phone, can the existence of a number of commonly used mobile phones sentence, when used directly out in front with the names of MM can be sent, without the need of a word by word out of. Sentence is shared Flyweight, MM name is extracted from the external characteristics, according to the context of the situation of use. Flyweight pattern: FLYWEIGHT middle finger in the lightweight boxing match. Flyweight pattern to share effective ways to support a large number of fine-grained objects. Element model can do to enjoy sharing the key is to distinguish between inner and outer Yun-state status. Intrinsic state is stored in the internal element to enjoy, will not change with the environment vary. Implies a state of things is that, with the changes in the environment change. Implies a state of things does not affect intrinsic state, which are independent of each other. Will be able to share the state and the state can not share class from the conventional distinction between the state will not be shared out removed from the class. The client can not directly create the object to be shared, and should be used to create a factory object is responsible for the object to be shared. Element model to enjoy a substantial reduction in the number of objects in memory.
12, PROXY: online chat with the MM, one is always at the beginning of "hi, Hello," "Where you come from?" "How old are you?" "How much is it?" These words, really annoying, write a program as my Proxy bar, all received them all set up their own answer, in other words to receive notice when I replied, how, cool it. Agent model: a proxy object model to provide a proxy object, the proxy object to control the source object. Agent is a person or an institution on behalf of another person or an institution to take action. Some cases, customers do not want to or can not be a direct reference to objects, agents can target customers and target audiences directly play the role of intermediary. Not distinguish between the client proxy object and the real theme of the theme object. Agent model can not know the real object of the agent, but merely a proxy object to hold the interface, when the proxy object that can not be proxy object created by the proxy object must have a system on behalf of the other players to create and imported.
13, CHAIN OF RESPONSIBLEITY: English classes at night to go on, in order to better开溜a row to sit down at the end, wow, sitting in front of a number of beautiful MM hey, look Zhang note, written on "Hi, my girlfriend can do ? If not want to move forward Biography ", a piece of paper after another on a pass up, and worst, spread to the first row of the MM to a piece of paper to the teacher, I heard that it is old, run! responsibility Chain: Chain of responsibility, many objects of each object from its reference under the home and then together to form a chain. Request for transfer in the chain until the chain of a decision of an object to process this request. Customers do not know which chain to deal with the request of the final object, the system can not affect the client in the case of dynamic re-organization and distribution of the responsibility chain. To deal with those who have two choices: take responsibility or passing the buck to the next house. A request can not be the end of any object accepted by the receiving end.
14, COMMAND: I have a MM control particularly strict at home, can not meet, but to help her brother in the transmission of information between the two of us, she told me what the instructions to write a note on her younger brother to me . This does not, then send her brother over a COMMAND, to thank him, I asked him to eat a bowl of sauce miscellaneous face, which knew that he said: "I at the same time to send my sister her boyfriend of three COMMAND, the smallest on the number of your gas, only asked me to eat noodles. ", command modes: command mode or operation of a request to an object in the package. Command mode to make the issue of responsibility and command responsibility for the implementation of separate commands, assigned to different audiences. Command mode request to allow a party to an independent party and send off, making the request of the party do not have to know that the party receiving the request of the interface, not know how the request was received, as well as whether to operate, when and how the execution was the implementation of of. System to support the revocation order.
15, INTERPRETER: I have a "bubble MM真经" There are a variety of foam above the Raiders MM, for example, the steps to eat Western food, the way to go to the movies and so on, with the MM date, as long as an Interpreter, according to the implementation of the script above it. Interpreter mode: given a language to explain the definition of a mode can be an expression of its grammar, as well as providing an interpreter. The client can use the interpreter to interpret the language of the sentence. Mode will be described to explain how a simple grammar, the use of models designed to explain these statements. Mode in the interpretation of the language which referred to the interpretation means any object can be explained in any combination. Mode in the interpretation of the need to define a grammar of the order on behalf of the hierarchical structure of categories, that is, a combination of a series of rules. Each command object has a method to explain, on behalf of the interpretation of the command object. Command object in the hierarchical structure of objects is a permutation and combination in any language.
16, ITERATOR: I fell in love with Mary, desperate to marry him to her. Mary: "I told you want to get married, have agreed to my conditions," I: "What I have agreed to the conditions, you say" Mary: "I saw a one carat diamond that" I: "I bought, I bought , as well as you? "Mary:" I saw a lake villa那栋"I:" I bought, I bought, as well as you? "Mary:" I saw Ferrari sports car "I am the head of Ong say, sitting in a chair, a teeth: "I bought, I bought, there is it?" ... ... iterative sub-modes: Iterative sub-model can be gathered in order to visit one of the elements together without having to expose the internal representation. Multiple objects together to form the general call to gather together is a group of objects can accommodate container object. Iterative sub-model will be iterative logic package into a separate sub-object, thus separated and gathered itself. Iterative sub-mode interface to simplify the gathering. Gathered every object can have one or more sub-object iterative, each iteration of the iterative sub-state can be independent of each other. Iterative algorithm can be independent of changes in the role of aggregation.
17, MEDIATOR: four MM playing mahjong, who between them should be considered to whom is not clear how much money, and fortunately I was in the next, in accordance with their respective chip count money, the money get from me, pay the money also paid to me, everything you OK, I received four telephone MM. Mediation model: the mediation model packing a series of object interaction, making these objects do not have significant effect on each other. So that they can be loosely coupled. When some object changes between the role, it will not immediately affect the other between the role of the object. Role to ensure that these changes can be independent of each other. Mediator of the interaction model will be transformed into many-to-many one-to-many interactions. Mediator object model will be abstract and collaboration, and the objects in the small-scale behavior of the interaction with other objects be dealt with separately.
18, MEMENTO: a number of MM at the same time to chat with, we must bear in mind with the MM clear just what that otherwise will not be happy MM found the Well, fortunately I have a memorandum of understanding with which MM just said what I all copies of a memorandum on the inside to preserve, so can you see the previous record. Memorandum of modes: a memorandum is another object used to store a snapshot of the internal state of the object. Model memorandum of intent is not to undermine the package under the conditions of the state of an object will be caught, and external, storage, and thus the right time in the future to restore this object to the stored state.
19, OBSERVER: We would like to know the latest information you MM? MM joined the company's information e-mail group on the list, tom is responsible for gathering intelligence, he found no new information to notify us one by one, directly to the e-mail group, we, as subscribers (observers) can be received in a timely manner information on the observer model you : Observer Pattern defines a team of a number of dependencies, so that the object at the same time a number of observers to monitor a subject of the object. The theme of the object in a state of change, the object will be notified of all observers, so that they can update themselves automatically.
20, STATE: when dealing with the MM, we must pay attention to the state of her Oh, in a different state will have different behavior, such as you about her go to the movies tonight, you are not interested in the MM would say "there are things you "do not hate you but not like the MM would say," Okay, but you can put on my colleagues? "has been in love with your MM would say" What time? watching the film again how to go around bars? ", of course, you can see a good film the process, they can never hate the state of MM do not like to become like Oh. State model: the state model allows an object in its internal state to change the behavior change. This object looks like is to change its type, like. Model to study the state of the object of the acts of the state of packaging in different objects, each object belonging to a state of the state of an abstract category of a sub-category. The intention of the state model is an object in its internal state to change when it changes its behavior. State model of a system need to be achieved in each state to create a state of the sub-class category. When the system state changes, the system will change the selected sub-category.
21, STRATEGY: The MM with different types of appointments, use different strategies, some films are better, please, some snacks to eat well, some of the most appropriate to the seaside romance, single purpose is to get the MM heart, my kit up in a lot of MM Oh Strategy. Strategy Mode: Strategy Mode for a set of algorithms, an algorithm for each package with a common interface to the independent category, so that they can replace each other. Strategy pattern allows algorithms can affect the client's circumstances change. Strategy mode to separate the behavior and the environment. Environmental behavior is responsible for the maintenance and query type, a variety of algorithms in the specific category strategies provided. Algorithm and the environment as a result of an independent open, the algorithm changes, changes will not affect the environment and the client.
22, TEMPLATE METHOD:: read "How to convince the girls to bed," this classic article, you? Realize that girls go to bed from the steps into the same chance, to break the deadlock and start the pursuit, kissing, the former drama, hands, caressing, into eight steps (Template method), but each of these steps for different situations, there are not the same as approach, which depends on you, you act according to circumstances (concrete); Template Method Pattern: Template Method Pattern to prepare an abstract class, some logic to the specific methods and the specific form of the realization of sub-structure, and then declare a number of abstract methods to force the sub-class the realization of the remaining logic. Sub-class can be different in different ways to achieve these abstract methods, thus remaining the realization of different logic. First to develop a top-level logical framework, and will leave the details to the logic of the specific sub-category to be realized.
23, VISITOR: Valentine's Day to give each MM to send a bouquet of flowers and a card, but each flower must be sent to MM for her personal characteristics, each card should be based on individual characteristics pick, I which made clear a person, or find a florist and gift shop owners to do what the boss Visitor, flower shop owner so that the characteristics of the election in accordance with MM a bouquet of flowers, so that the gift shop owner in accordance with the characteristics of each person selected a card, so that easy more; visitor mode: The purpose of the visitor pattern is imposed on a package of some data on the operation of structural elements. Once these operations to be amended, to accept the operation of the data structure can remain unchanged. Visitors mode data structure for the system is relatively uncertain, the data structure and its role in the structure of the operation of the coupling between the open release, the collection can be made to operate relatively free of the evolution. Allows visitors to add a new mode of operation can easily be changed, that is, add a new category of visitors. Visitor behavior patterns will focus on the object to a visitor, rather than distributed among the nodes of a category. When using the visitor pattern, the object of as much as possible to the logic on the visitors browser type, rather than put it in the subclass. Visitors can be across several categories to visit the hierarchical structure of the hierarchical structure belong to different categories of members.







