11.07.2015 Views

Encyclopedia of Computer Science and Technology

Encyclopedia of Computer Science and Technology

Encyclopedia of Computer Science and Technology

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

142 design patternsdesign patternsDesign patterns are an attempt to abstract <strong>and</strong> generalizewhat is learned in solving one problem so that it canbe applied to future similar problems. The idea was firstapplied to architecture by Christopher Alex<strong>and</strong>er in hisbook A Pattern Language. Alex<strong>and</strong>er described a pattern asa description <strong>of</strong> situations in which a particular problemoccurs, with a solution that takes into account the factorsthat are “invariant” (not changed by context). Guidance forapplying the solution is also provided.For example, a bus stop, a waiting room, <strong>and</strong> a line ata theme park are all places where people wait. A “place towait” pattern would specify the problem to be solved (howto make waiting as pleasant as possible) <strong>and</strong> suggest solutions.Patterns can have different levels <strong>of</strong> abstraction orscales on which they apply (for example, an intimate theater<strong>and</strong> a stadium are both places <strong>of</strong> entertainment, butone is much larger than the other).Patterns in turn are linked into a network called a patternlanguage. Thus when working with one pattern, thedesigner is guided to consider related patterns. For example,a pattern for a room might relate to patterns for seatingor grouping the occupants.Patterns in S<strong>of</strong>twareThe concept <strong>of</strong> patterns <strong>and</strong> pattern languages carries overwell into s<strong>of</strong>tware design. As with architectural patterns,a s<strong>of</strong>tware pattern describes a problem <strong>and</strong> solution, alongwith relevant structures (see class <strong>and</strong> object-orientedprogramming). Note that patterns are not executable code;they are at a higher level (one might say abstract enough tobe generalizable, specific enough to be applicable).S<strong>of</strong>tware patterns can specify how objects are created<strong>and</strong> ways in which they function <strong>and</strong> interface with otherobjects. Patterns are generally documented using a commonformat; one example is provided in the book Design Patterns.This scheme has the following sections:• name <strong>and</strong> classification• intent or purpose• alternative names• problem—the kind <strong>of</strong> problem the pattern addresses,<strong>and</strong> conditions under which it can be used• applicability—typical situations <strong>of</strong> use• structure description—such as class or interactiondiagrams• participants—classes <strong>and</strong> objects involved in the pattern<strong>and</strong> the role each plays• collaboration—how the objects interact with oneanother• consequences—the expected results <strong>of</strong> using the pattern,<strong>and</strong> possible side effects or shortcomings• implementation—explains a way to implement thepattern to solve the problem• sample code—usually in a commonly used programminglanguage• known uses—actual working applications <strong>of</strong> thepattern• related patterns—other patterns that are similar orrelated, with a description <strong>of</strong> how they differAn example given in Design Patterns is the “publishsubscribe”pattern. This pattern describes how a number<strong>of</strong> objects (observers) can be dependent on a “subject.” Allobservers are “subscribed” to the subject, so they are notifiedwhenever any data in the subject changes. This patterncould be used, for example, to set up a system where differentreports, spreadsheets, etc., need to be updated whenevernotified by a controlling object that has received new data.Some critics consider the use <strong>of</strong> patterns to be tooabstract <strong>and</strong> inefficient. Since a pattern has to be re-implementedfor each use, it has been argued that well-documented,reusable classes or objects would be more useful.Proponents, however, argue that “design reuse” is morepowerful than mere “object reuse.” A pattern provides awhole “language” for talking about a problem <strong>and</strong> its provensolutions, <strong>and</strong> can help both the original designer <strong>and</strong> othersunderst<strong>and</strong> <strong>and</strong> extend the design.Further ReadingAlex<strong>and</strong>er, Christopher. A Pattern Language: Towns, Buildings,Construction. New York: Oxford University Press, 1977.“Design Patterns.” IBM Research. Available online. URL: http://www.research.ibm.com/designpatterns/. Accessed September10, 2007.Freeman, Eric, <strong>and</strong> Elisabeth Freeman. Head First Design Patterns.Sebastapol, Calif.: O’Reilly, 2004.Gamma, Erich, et al. Design Patterns: Elements <strong>of</strong> Reusable Object-Oriented S<strong>of</strong>tware. Upper Saddle River, N.J.: Addison-WesleyPr<strong>of</strong>essional, 1995.Kurotsuchi, Brian T. “Welcome to the Wonderful World <strong>of</strong> DesignPatterns.” Available online. URL: http://www.csc.calpoly.edu/~dbutler/tutorials/winter96/patterns/. Accessed September10, 2007.desktop publishing (DTP)Traditionally documents such as advertisements, brochures,<strong>and</strong> reports were prepared by combining typed or printedtext with pasted-in illustrations (such as photographs <strong>and</strong>diagrams). This painstaking layout process was necessaryin order to produce “camera-ready copy” from which aprinting company could produce the final product.Starting in the late 1980s, desktop computers becamepowerful enough to run s<strong>of</strong>tware that could be used to createpage layouts. In addition, display hardware gained ahigh enough resolution to allow for pages to be shown onthe screen in much the same form as they would appear onthe printed page. (This is known by the acronym WYSI-WYG, or “what you see is what you get.”) The final ingredientfor the creation <strong>of</strong> desktop publishing was the advent <strong>of</strong>affordable laser or inkjet printers that could print near printquality text <strong>and</strong> high-resolution graphics (see printers).This combination <strong>of</strong> technologies made it feasible fortrained <strong>of</strong>fice personnel to create, design, <strong>and</strong> produce many

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!