http://www.lzhlj.com/articles/article_show.asp?articleid=14&articlepage=1
Summary Software Design Mode comes from the architecture mode and object movement of Christopher Alexander. According to the view of Alexander, the mode is a repetition of a general solution itself for a particular system. Object movements are focused on the relationship between the real world is modeled as the internal relationship. Based on these two reasons, software design model should be repeated for objects of real-world objects. This article presents the non-software mode instance in the world, these models come from "Design Mode - Decisive Object Software" (DESIGN PATTERNS - Elements of Reusable Object-Oriented Software) [13] . This article also discusses the practice of mode language on non-software expressiveness and design patterns. Introduction In the software industry, the group supporter's group is expanding. The origin of model development can be found in the work of architect Christopher Alexander. He believes that the model is a general solution in the world's specific system. The model he describes can be observed in daily buildings. Each mode in "a pattern language" [2] contains a picture of the original example of this mode. Although material is the mainstream world's view, the model is believed by the software world, and the model also has the root cause of the development of things [9]. Unfortunately, the example of software design model is not as rich as Alexander mode, because software design is exquisite ideas rather than those who originally generated [13]. The proppiaibility of most software today limits our opportunity to exposure to first-class design. According to Alexander, the model in the real world is always repeating yourself, because in a specific environment, they always adapt to existing environmental factors [1]. In software, either real world problem is completely modeled, or the real world object is converted into hardware and software, used to generate the results of the real world [5]. Since the software design pattern is rooted in Alexander's style and object, it is normal to find software design patterns in the real world. This is not to say that the software design model is an inevitable model of real world things, but it is said that the relationship between the interaction between the actual object can be observed in the "real world" and software object. In order to verify this assumption, we will find an example of a real world for each design pattern. These examples are listed in Section 2 to Section 4 below. Create a model author (referring to the author of "design mode" - the following, the following, summarizes five creation modes. Examples of creation modes can be found in manufacturing, fast food, biological and administrative agencies. Abstract Factory Example Abstract Factory is to provide an interface that creates a series of associated or interdependent objects without having to specify their specific classes. This model can be found in the metal stamping equipment used in Japan's automobile manufacturing plants. This stamping device can make the car body part. The same machinery is used in the right door of different models, left door, right front fender, left front fender and hood, etc. By using a wheel to change the punch plate, the specific class of this machine can be changed within three minutes [16]. Figure 1: Pressure example of abstract factory
Builder Example Generator Mode Separates the build of complex objects with the performance of the object, which makes the same build process can create different performance. This model is used for fast food store making children's meals. Typical children's meals include a staple food, a complementary food, a drink and a toy (such as hamburger, fried chicken, cola and toy car). These can be different in different child meals, but the process of combining children's meals is the same. Regardless of the customer point, it is the same as the three cure or chicken, the process is the same. The staff of the counter directly puts staple food, complementary food and toys. These are placed in a bag. The beverage is poured into the cup and placed outside the bag. These processes are the same in mutual competitive restaurants. Figure 2: Object role of the generator mode using children meals as an example
Factory Method Factory Method defines an interface for creating an object, but which class makes subclasses to instantiate. Pressure is presented in this mode. Plastic toy manufacturer processes plastic powder to implant the plastic into the mold of the desired shape [15]. The category of the toy (car, characters, etc.) is determined by the mold. Figure 3: Object map prototype of a factory method using an injection molding as an example of a prototype mode specifies the type of creating an object using a prototype instance. The prototype of the new product is usually established before all products. Such prototypes are passive and do not participate in copy itself. A cells have a mitosis, producing two same cells, an example of playing an active role to copy its own prototype, which demonstrates the prototype mode. A cell division produces two cells of the same genotype. In other words, the cells were cloned.
Singleton Example Single mode Make sure that a class has only one instance and provides a global access point access to it. Single mode is mimic monitors named, and the definition of a single set is that each collection contains only one element. The president of the US president is a single piece, the US constitution provides for the presidential election, term, and succession of the sequence. In this way, only a current president can be used at any time. Regardless of the current president, its title "President of the United States of America" is a global access point for people who visit this position.
Figure 5: Single-piece Mode Object Chart Structure Structure Authority using the President Example Structure Summary The seven structural modes, these modes can be found in tools, residential wirings, mathematics, festive traditions, retail catalogs, and banking industries
Adapter Example Adapter Mode allows you to convert a class interface into another interface that is expected, so that you can work together due to interfaces that are not compatible and cannot work together. The wrench provides an example of an adapter. A hole is in ratchet, and the dimensions of each side of the ratchet is the same. In the US typical side length of 1/2 '' and 1/4 ''. Obviously, if a adapter is not used, the ratchet 1/2 '' ratchet is not suitable for 1/4 '' holes. A 1/2 '' to 1/4 '' adapter has a 1/2 '' shaped slot to set a 1/2 '' teeth, and there is a 1/4 cylinder to cartridge 1 / 4 '' Wrench Bridge (Bridge) Example
Bridge (Bridge) Example Bridge mode separates the abstraction portion with its implementation, so that they can change independently. An ordinary switch-controlled electric light, electric fan, etc. are examples of bridging. The purpose of the switch is to turn the device on or off. The actual switch can be a simple double-knife zipper switch, or a dimming switch. Figure 7: Combination of a combination of a combination of a combination using an electronic switch example is combined into a tree structure to represent a "portion-overall" hierarchy. Let the user consistently use a single object and a combination object. Although the example is abstract, the arithmetic expression is indeed a combination. The arithmetic expression includes operands, operators, and another operand. The number of operands can be numbers or another expression. In this way, 2 3 and (2 3) (4 * 6) are legal expressions. Figure 8: Decoration (Decorator) Example Decoration mode dynamically add an additional duty to an object using an arithmetic expression example. Whether there is a picture without a picture, it can be hung on the wall, but it usually has a picture, and it is actually a picture frame being hung on the wall. Before hanging on the wall, the painting can be blinded, put it into the box; this time the painting, the glass and picture frame form an object. Figure 9: Decorative mode object diagram appearance (FACADE) with a picture with picture frame For example, the appearance mode defines a unified higher level interface for the interface in the subsystem for use. When the consumer is procured according to the directory, it reflects an appearance mode. Consumers have dial a number and customer service representative, and the customer service representative played this "look". He contains the interface with the order department, the cash register and the delivery department. Figure 10: Example Object Chart Enjoying Yuan (Flyweight) illustrated by phone order example Example Enjoying Yuan Mode effectively supports a lot of fine-grained objects using shared technology. The public switched telephone network (PSTN) is an example of enjoying the yuan. There are some resources such as dialing generators, ringing generators, and dial receivers that must be shared by all users. When a user picks up the handset, he doesn't need to know how much resources have been used. For users, all things are dial tones, call the number, and call the phone. Figure 11: The Enjoyment Mode Object Agent (Proxy) mode proxy mode using the dial tone generator is provided to control access to this object. A check or bank deposit is a proxy for funds in the account. The check is used in market transactions in place of cash and provides control over the funds on the issuer. Figure 12: Agent mode object map behavior pattern by using a bank deposit case example author summarizes eleven behavior patterns. These modes can find examples in coin classification banks, restaurant ordering, music, transportation, automotive repair, vending machines and home buildings. CHAIN OF RESPONSIBILITY example The duties chain mode makes multiple objects have the opportunity to process the request, thereby avoiding the coupling relationship between the requested sender and the recipient. Mechanical coin sorting bank uses a duties chain. This is not assigned a slide for each coin, but only one slide is used. When the coin falls, the coin is guided by the inside of the bank to the appropriate receiving box. Figure 13: Dog chain mode object map using a coin sorting example
Command (Command) mode command mode The request is packaged into an object so that you can use different requests to parameterize the customer. The bill when dining is an example of command mode. The waiter accepts the customer's order and records it on the bill. This order is queued to wait for cooking. Note that the "bill" here is not dependent on the menu, which can be used by different customers, so it can add different point items. Figure 14: Command Mode Object Diagram Using Dining Example Example The interpreter mode defines a grammatic representation and interpretation of the specific language. Musicians are examples of interpreters. The scale and its duration can be represented by the symbols on the five-tier spectrum. These symbols are music language [14]. The musicians can repeatedly reproduce the same music according to the music. Figure 15: Explanation Object Diagram Itecher Example The Itertree Object Diagram Using Music Example The iterator provides a method sequence to access the individual elements in a collection object, and does not need to expose the internal representation of the object. In the early TV, a dial is used to change the channel. When the channel is changed, you need to manually turn the dial to move each channel, regardless of whether this channel has a signal. Now TV, use [next] and [previous] button. When the [Take one] button is pressed, it will switch to the next preset channel. Imagine watching TV in the hotel in a strange city. When changing the channel, it is important not a few channels, but the contents of the program. If you are not interested in a channel of a channel, you can replace a channel without knowing it is a few channels. Figure 16: Iterative Mode Object Diagram Biller (Mediator) Example The mediator mode is used to control a series of object interactions with one intermediary object. The loose coupling between the individual objects is achieved by the intermediaries, not directly to each other. The control tower of the airport demonstrates this model. The plane that landed or take-off directly communicates with the tower instead of directly communicating with each other. Who can take off or landing is determined by the tower. It should be noted here that the tower does not control the entire flight process. It is only responsible for the area near the airport. Figure 17: Memorant Memorial Memorial (MEMENTO) example of the Memant Memory Memorial Using the Training Center is captured and the internal state of an object is saved so that the object can be restored to the state. This model is usually reflected in the brakes of your own repairs. First remove the baffle on both sides, reveal the left and right brake pads. Only one piece can only be removed, then another piece is used as a memo to indicate how the brake is installed. After this repair is completed, you can remove it. When the second piece is removed, the first piece will become a memo. Figure 18: Memo mode Object map Observer mode Observer using a brake pad example defines a pair of relationships between objects, when the status of an object changes, all objects that depend on its object are notified and automatically updated. . Auction demonstrates this model. Each bidder has a brand label for bid. When the auctione starts auction, he observes whether there is a brand raised bid. Each time you accept a new bid, you have changed the current price of the auction and broadcast to all biders for new bids. Figure 19: Observer mode status (state) mode status mode using auction example allows an object to change its behavior when its internal state changes. This model can be observed on the vending machine. The status of the vending machine includes a list of column list, payment, money to find money, and choice of goods. When putting a coin and selects a commodity, the vending machine can complete the following operations, including: sending out the goods do not find money, sending out the goods and finding money, because the coin is less than the goods, because the goods are not sent out of the goods.
Figure 20: Status Mode Object Graph Policy (Strategy) mode policy mode using a vending machine example defines a series of algorithms that can be replaced with each other. Different ways to go to the airport are examples of a policy mode. There are several options: driving themselves, take a taxi, take the airport shuttle, take a bus or use a car service, and so on. For some airports, subways and helicopters are also possible. Any way can you send you to the airport, which can be replaced with each other. You must make a choice based on price, convenience and time. Figure 21: Declaring a Template Method for an Example Defining a skeleton of an operation algorithm in an operation, delay some steps into subclasses. Housing architects use template methods when developing new projects. A typical plan includes some construction plan, each of which reflects different parts. In a plan view, foundations, structures, upper and lower water, and traces are the same for each room. Different housing patterns are only available in the later stage of the building. Figure 22: Template Method Template Using Building Flat Chart As an example visitor mode represents an operation of each element in an object structure, defining this operation does not change the class of elements. This model can be observed in the operation of the taxi company. When a person called a taxi company, he (she) became a member of all the company's customers. The company then specifies a car to serve (accepting visitors). After entering the taxi, this person (visitor) no longer controls his (her) journey, but is responsible by the taxi (driver). Figure 23: Observer mode object map using a taxi example The author has shown the presence of a non-software example of the software design mode. Maybe some people want to know the practical significance of these examples. Non-software examples help enhance the expression of the pattern language and the learning of the auxiliary mode. Increasing mode language Expression Ability Alexander feels that true mode is integrated into a common language so that everyone can share [2]. In the population of software design, the pattern is considered to be a conventional development method between colleagues [4,17]. The mode provides a higher level of the module, process, and object [10]. An important factor in a language is the soul image corresponding to the language image. In a language, only one person can understand the meaning of a symbol, can draw this meaning in your heart [7]. Alexander does not ignore this important feature of the mode language, which is stipulated that the language is only completely morbid only after the building type it produces can be specifically seen. [1]. In software design, Richle and Züllighoven realize that specific examples guided our understanding of the understanding of the application [12]. If the software design pattern becomes a common language in the programmer, its foundation is a unified meaning. If the design decision is reached, but it is not understood, the designer is forced to complete the work by hypotheses [19]. Oriented examples are more convenient, the reason is that people must find the associated content in memory [20]. In an AG Communication Systems company project, a non-software example is often used to interpret the relationship between modes. This example helps to provide a unified understanding between designers. By establish a unified understanding of the design process, the communication between the designers is easier in the entire project life cycle. Non-software examples As a learning model, the student needs examples when the new concept occurs. This can be seen in the summary of the AG Communication Systems' model, and this is also summarized by others [12]. When studying new things, students naturally use learning knowledge to help new concepts [6]. For this reason, many examples should be proposed when the student first contacts the software design mode [12].
Some examples should be submitted after a period of study, rather than waiting for them. Providing similar examples do not increase new content that needs to be learned. At this time, selecting the student extracurricular examples can avoid learning the shortage of material. Since the mode is eventually stayed in the human mind [11], it is possible to use most people familiar with examples and training materials from memory. Conclusion The embodiment of software design mode in non-soft examples indicates that the mode is not limited to a particular field. Software designers can benefit from these daily things, even if these examples are not expressed in programming language. This article will raise most people familiar with (although some tend to be North American culture). Through a description of a common experience, these examples help understand specific design patterns and can help to learn from design patterns. ※ Thank you, this article is Thank you very much for Dalmatian Group Brandon GoldFedder, AG Communication Systems Linda Rising, Humans and Technology's Alistair Cockburn and Illinois University's Ralph Johnson's beneficial advice made in this article.
※ Reference book 1. Alexander, C. The Timeless Way Of Building. Oxford University Press, 1979. 2. Alexander, C., et al. A pattern Language. Oxford University Press, 1977. 3. Anthony, D. Patterns for Classroom Education ", In Pattern Languages of Program Design II, Addison-Wesley, 1996. 4. Berczuk, S." Finding Solutions Through Pattern Languages ", Computer, Vol. 27, No. 12. December, 1994. 5. Booch, G. "Object Oriented Design" in Tutorial on Software Design Techniques, pp 420-437, IEEE Computer Society, 1984. 6. Carroll, J.. "The Nurnberg funnel: Designing minimalist instruction for practical computer skill", MIT Press, 1990 . 7. Chierchia, G. and McConnel-Ginnet, S. Meaning and Grammar:.. An Introduction to Semantics MIT Press, 1990. 8. Chilton, Chilton's Auto Repair Manual, Chilton Book Company, 1985.9 Coplien, J. "Broadening beyond Objects to patterns and to other paradigms ", Position Statement for the ACM WORKSHOP ON StrateGic Directions In Computing Research, MIT, JUNE 14-15, 1996.10. Coplien, J. "Idioms, Patterns, and Other Architectural Literature", IEEE Software, November, 1996.11. Cunningham W., Johnson, R., Introduction to Pattern Languages of Program Design, Addison-Wesley, 1995.12. DeBruler, D. "A Generative Pattern Language for Distributed Processing