WATERLOO CHERITON SCHOOL OF COMPUTER SCIENCE Gang of Four (GoF) OO Design Patterns CS 446/646 ECE452 May 11th, 2011 IMPORTANT NOTICE TO STUDENTS These slides are NOT to be used as a replacement for student notes. These slides are sometimes vague and incomplete on purpose to spark class discussions. Sep 24, 2014 Gang of Four/GOF design patterns in Java starts with the basic definition of a design pattern, lists the 3 categories of GOF Design Patterns, lists all the individual GOF design patterns category-wise with a brief description, along with a link to the detailed tutorial in Java. The authors of the DesignPatternsBook came to be known as the 'Gang of Four.' The name of the book ('Design Patterns: Elements of Reusable Object-Oriented Software') is too long for e-mail, so 'book by the gang of four' became a shorthand name for it.
Design Patterns: Elements of Reusable Object-Oriented Software (1994) is a software engineering book describing software design patterns. The book was written by Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides, with a foreword by Grady Booch. The book is divided into two parts, with the first two chapters exploring the capabilities and pitfalls of object-oriented programming, and the remaining chapters describing 23 classic software design patterns. The book includes examples in C++ and Smalltalk.
It has been influential to the field of software engineering and is regarded as an important source for object-oriented design theory and practice. More than 500,000 copies have been sold in English and in 13 other languages. The authors are often referred to as the Gang of Four (GoF).[1]
History[edit]
The book started at a birds of a feather (BoF) session at OOPSLA '90, 'Towards an Architecture Handbook', run by Bruce Anderson, where Erich Gamma and Richard Helm met and discovered their common interest. They were later joined by Ralph Johnson and John Vlissides.[2] The original publication date of the book was October 21, 1994 with a 1995 copyright, hence it is often cited with a 1995-year, despite being published in 1994. The book was first made available to the public at the OOPSLA meeting held in Portland, Oregon, in October 1994.In 2005 the ACM SIGPLAN awarded that year's Programming Languages Achievement Award to the authors, in recognition of the impact of their work 'on programming practice and programming language design'.[3] As of March 2012, the book was in its 40th printing.
Jan 14, 2008 version: v.1.0.3189 - v.1.1.3280. Supreme Commander v1.1.3280. The v1.1.3280 patch for Supreme Commander will install a small series of display updates. The ultimate source of patches & addons for Supreme Commander. Supreme commander update download.
Introduction, Chapter 1[edit]
Chapter 1 is a discussion of object-oriented design techniques, based on the authors' experience, which they believe would lead to good object-oriented software design, including:
The authors claim the following as advantages of interfaces over implementation:
Use of an interface also leads to dynamic binding and polymorphism, which are central features of object-oriented programming.
The authors refer to inheritance as white-box reuse, withwhite-box referring to visibility, because the internals of parent classes are often visible to subclasses. In contrast, the authors refer to object composition (in which objects with well-defined interfaces are used dynamically at runtime by objects obtaining references toother objects) as black-box reuse because no internal details of composed objects need be visible in the code using them.
The authors discuss the tension between inheritance and encapsulation at length and state that in their experience, designers overuse inheritance (Gang of Four 1995:20). The danger is stated as follows:
They warn that the implementation of a subclass can become so bound up with the implementation of its parent class that any change in the parent's implementation will force the subclass to change. Furthermore, they claim that a way to avoid this is to inherit only from abstract classes—but then, they point out that there is minimal code reuse.
Using inheritance is recommended mainly when adding to the functionality of existing components, reusing most of the old code and adding relatively small amounts of new code.
To the authors, 'delegation' is an extreme form of object composition that can always be used to replace inheritance. Delegation involves two objects: a 'sender' passes itself to a 'delegate' to let the delegate refer to the sender. Thus the link between two parts of a system are established only at runtime, not at compile-time. The Callback article has more information about delegation.
The authors also discuss so-called parameterized types, which are also known as generics (Ada, Eiffel, Java, C#, VB.NET, and Delphi) or templates (C++). These allow any type to be defined without specifying all the other types it uses—the unspecified types are supplied as 'parameters' at the point of use.
The authors admit that delegation and parameterization are very powerful but add a warning:
The authors further distinguish between 'Aggregation', where one object 'has' or 'is part of' another object (implying that an aggregate object and its owner have identical lifetimes) and acquaintance, where one object merely 'knows of' another object. Sometimes acquaintance is called 'association' or the 'using' relationship. Acquaintance objects may request operations of each other, but they aren't responsible for each other. Acquaintance is a weaker relationship than aggregation and suggests much looser coupling between objects, which can often be desirable for maximum maintainability in a design.
The authors employ the term 'toolkit' where others might today use 'class library', as in C# or Java. In their parlance, toolkits are the object-oriented equivalent of subroutine libraries, whereas a 'framework' is a set of cooperating classes that make up a reusable design for a specific class of software. They state that applications are hard to design, toolkits are harder, and frameworks are the hardest to design.
Case study, Chapter 2[edit]
Chapter 2 is a step-by-step case study on 'the design of a 'What-You-See-Is-What-You-Get' (or 'WYSIWYG') document editor called Lexi.' (pp.33)
The chapter goes through seven problems that must be addressed in order to properly design Lexi, including any constraints that must be followed. Each problem is analyzed in depth, and solutions are proposed. Each solution is explained in full, including pseudo-code and a slightly modified version of Object Modeling Technique where appropriate.
Finally, each solution is associated directly with one or more design patterns. It is shown how the solution is a direct implementation of that design pattern.
The seven problems (including their constraints) and their solutions (including the pattern(s) referenced), are as follows:
Leblanc Clarinet Serial Numbers Date Of Manufacture 'Carolyn Sue Kincaid Chesnut Plays Exclusively Leblanc Paris Clarinets' Our roots trace back to 1750, to the court of Louis XV, before Mozart was born. Wind instruments were still evolving into the forms we would recognize today when Ets. Noblet was founded in France. Leblanc 576 – pics from eBay 6/2013. Symphonie Model – 1950 (raw nickel silver) ex: sn 172A. The original serial numbers were 3 digit with a “A” at the end. In 1951 they dropped the “A”. Leblanc paris clarinet serial numbers. Leblanc 417 Bass Clarinet 1978 0 1979 0 1980 8 1981 0 1982 Disc.
Document Structure[edit]
The document is 'an arrangement of basic graphical elements' such as characters, lines, other shapes, etc., that 'capture the total information content of the document'(pp.35). The structure of the document contains a collection of these elements, and each element can in turn be a substructure of other elements.
Problems and Constraints
Solution and Pattern
A recursive composition is a hierarchical structure of elements, that builds 'increasingly complex elements out of simpler ones' (pp.36). Each node in the structure knows of its own children and its parent. If an operation is to be performed on the whole structure, each node calls the operation on its children (recursively).
This is an implementation of the composite pattern, which is a collection of nodes. The node is an abstract base class, and derivatives can either be leaves (singular), or collections of other nodes (which in turn can contain leaves or collection-nodes). When an operation is performed on the parent, that operation is recursively passed down the hierarchy.
Formatting[edit]
Formatting differs from structure. Formatting is a method of constructing a particular instance of the document's physical structure. This includes breaking text into lines, using hyphens, adjusting for margin widths, etc.
Problems and Constraints
Solution and Pattern
A Compositor class will encapsulate the algorithm used to format a composition. Compositor is a subclass of the primitive object of the document's structure. A Compositor has an associated instance of a Composition object. When a Compositor runs its
Compose() , it iterates through each element of its associated Composition, and rearranges the structure by inserting Row and Column objects as needed.
The Compositor itself is an abstract class, allowing for derivative classes to use different formatting algorithms (such as double-spacing, wider margins, etc.)
The Strategy Pattern is used to accomplish this goal. A Strategy is a method of encapsulating multiple algorithms to be used based on a changing context. In this case, formatting should be different, depending on whether text, graphics, simple elements, etc., are being formatted.
Embellishing the User Interface[edit]
The ability to change the graphical interface that the user uses to interact with the document.
Problems and Constraints
Solution and Pattern
The use of a transparent enclosure allows elements that augment the behaviour of composition to be added to a composition. These elements, such as Border and Scroller, are special subclasses of the singular element itself. This allows the composition to be augmented, effectively adding state-like elements. Since these augmentations are part of the structure, their appropriate
Operation() will be called when the structure's Operation() is called. This means that the client does not need any special knowledge or interface with the structure in order to use the embellishments.
This is a Decorator pattern, one that adds responsibilities to an object without modifying the object itself.
Supporting Multiple Look-And-Feel Standards[edit]Design Patterns Elements Of Reusable
Look-and-feel refers to platform-specific UI standards. These standards 'define guidelines for how applications appear and react to the user' (pp.47).
Problems and Constraints
Solution and Pattern
Since object creation of different concrete objects cannot be done at runtime, the object creation process must be abstracted. This is done with an abstract guiFactory, which takes on the responsibility of creating UI elements. The abstract guiFactory has concrete implementations, such as MotifFactory, which creates concrete elements of the appropriate type (MotifScrollBar). In this way, the program need only ask for a ScrollBar and, at run-time, it will be given the correct concrete element.
This is an Abstract Factory. A regular factory creates concrete objects of one type. An abstract factory creates concrete objects of varying types, depending on the concrete implementation of the factory itself. Its ability to focus on not just concrete objects, but entire families of concrete objects 'distinguishes it from other creational patterns, which involve only one kind of product object' (pp.51).
Supporting Multiple Window Systems[edit]
Just as look-and-feel is different across platforms, so is the method of handling windows. Each platform displays, lays out, handles input to and output from, and layers windows differently.
Problems and Constraints
Solution and Pattern
It is possible to develop 'our own abstract and concrete product classes', because 'all window systems do generally the same thing' (p.52). Each window system provides operations for drawing primitive shapes, iconifying/de-iconifying, resizing, and refreshing window contents.
An abstract base
Window class can be derived to the different types of existing windows, such as application, iconified, dialog. These classes will contain operations that are associated with windows, such as reshaping, graphically refreshing, etc. Each window contains elements, whose Draw() functions are called upon by the Window 's own draw-related functions.
In order to avoid having to create platform-specific Window subclasses for every possible platform, an interface will be used. The
Window class will implement a Window implementation (WindowImp ) abstract class. This class will then in turn be derived into multiple platform-specific implementations, each with platform-specific operations. Hence, only one set of Window classes are needed for each type of Window , and only one set of WindowImp classes are needed for each platform (rather than the Cartesian product of all available types and platforms). In addition, adding a new window type does not require any modification of platform implementation, or vice versa.
This is a Bridge pattern.
Window and WindowImp are different, but related. Window deals with windowing in the program, and WindowImp deals with windowing on a platform. One of them can change without ever having to modify the other. The Bridge pattern allows these two 'separate class hierarchies to work together even as they evolve independently' (p.54).
User Operations[edit]
All actions the user can take with the document, ranging from entering text, changing formatting, quitting, saving, etc.
Problems and Constraints
Solution and Pattern
Each menu item, rather than being instantiated with a list of parameters, is instead done with a Command object.
Command is an abstract object that only has a single abstract
Execute() method. Derivative objects extend the Execute() method appropriately (i.e., the PasteCommand.Execute() would utilize the content's clipboard buffer). These objects can be used by widgets or buttons just as easily as they can be used by menu items.
To support undo and redo,
Command is also given Unexecute() and Reversible() . In derivative classes, the former contains code that will undo that command, and the latter returns a boolean value that defines if the command is undoable. Reversible() allows some commands to be non-undoable, such as a Save command.
All executed
Commands are kept in a list with a method of keeping a 'present' marker directly after the most recently executed command. A request to undo will call the Command.Unexecute() directly before 'present', then move 'present' back one command. Conversely, a Redo request will call Command.Execute() after 'present', and move 'present' forward one.
This
Command approach is an implementation of the Command pattern. It encapsulates requests in objects, and uses a common interface to access those requests. Thus, the client can handle different requests, and commands can be scattered throughout the application.
Spell Check and Hyphenation[edit]
This is the document editor's ability to textually analyze the contents of a document. Although there are many analyses that can be performed, spell check and hyphenation-formatting are the focus.
Problems and Constraints
Solution and Pattern
Removing the integer-based index from the basic element allows for a different iteration interface to be implemented. This will require extra methods for traversal and object retrieval. These methods are put into an abstract
Iterator interface. Each element then implements a derivation of the Iterator , depending on how that element keeps its list (ArrayIterator , LinkListIterator , etc.).
Functions for traversal and retrieval are put into the abstract Iterator interface. Future Iterators can be derived based on the type of list they will be iterating through, such as Arrays or Linked Lists. Thus, no matter what type of indexing method any implementation of the element uses, it will have the appropriate Iterator.
This is an implementation of the Iterator pattern. It allows the client to traverse through any object collection, without needing to access the contents of the collection directly, or be concerned about the type of list the collection's structure uses.
Now that traversal has been handled, it is possible to analyze the elements of a structure. It is not feasible to build each type of analysis into the element structure themselves; every element would need to be coded, and much of the code would be the same for similar elements.
Instead, a generic
CheckMe() method is built into the element's abstract class. Each Iterator is given a reference to a specific algorithm (such as spell check, grammar check, etc.). When that Iterator iterates through its collection, it calls each element's CheckMe , passing the specified algorithm. CheckMe then passes a reference to its element back to said algorithm for analysis.
Thus, to perform a spell check, a front-to-end iterator would be given a reference to a
SpellCheck object. The iterator would then access each element, executing its CheckMe() method with the SpellCheck parameter. Each CheckMe would then call the SpellCheck , passing a reference to the appropriate element.
In this manner, any algorithm can be used with any traversal method, without hard-code coupling one with the other. For example, Find can be used as 'find next' or 'find previous', depending on if a 'forward' iterator was used, or a 'backwards' iterator.
In addition, the algorithms themselves can be responsible for dealing with different elements. For example, a
SpellCheck algorithm would ignore a Graphic element, rather than having to program every Graphic -derived element to not send themselves to a SpellCheck .
Patterns by Type[edit]Creational[edit]Gang Of Four Design Patterns Pdf
Creational patterns are ones that create objects, rather than having to instantiate objects directly. This gives the program more flexibility in deciding which objects need to be created for a given case.
Structural[edit]
These concern class and object composition. They use inheritance to compose interfaces and define ways to compose objects to obtain new functionality.
Behavioral[edit]
Most of these design patterns are specifically concerned with communication between objects.
Criticism[edit]
Criticism has been directed at the concept of software design patterns generally, and at Design Patterns specifically. A primary criticism of Design Patterns is that its patterns are simply workarounds for missing features in C++, replacing elegant abstract features with lengthy concrete patterns, essentially becoming a 'human compiler' or 'generating by hand the expansions of some macro'.[4]Peter Norvig demonstrates that 16 out of the 23 patterns in Design Patterns are simplified or eliminated (via direct language support) in Lisp or Dylan.[5] Related observations were made by Hannemann and Kiczales who implemented several of the 23 design patterns using an aspect-oriented programming language (AspectJ) and showed that code-level dependencies were removed from the implementations of 17 of the 23 design patterns and that aspect-oriented programming could simplify the implementations of design patterns.[6]
Paul Graham wrote:[4]
When I see patterns in my programs, I consider it a sign of trouble. The shape of a program should reflect only the problem it needs to solve. Any other regularity in the code is a sign, to me at least, that I'm using abstractions that aren't powerful enough-- often that I'm generating by hand the expansions of some macro that I need to write.
There has also been humorous criticism, such as a show trial at OOPSLA '99 on 3 November 1999,[7][8][a] and a parody of the format, by Jim Coplien, entitled 'Kansas City Air Conditioner'.
In an interview with InformIT in 2009, Erich Gamma stated that the book authors had a discussion in 2005 on how they would have refactored the book and concluded that they would have recategorized some patterns, added a few additional ones and removed one of them (Singleton) altogether.[9]
See also[edit]Notes[edit]
References[edit]
Retrieved from 'https://en.wikipedia.org/w/index.php?title=Design_Patterns&oldid=918419907'
Author: Richard Lawther
Downloads: 1018
Pages: 235
Published:
Gang Of Four Book Pdf Download1 year ago
Rating: Rated:3 times Rate It
Book Description HTML
An alien power that has been guiding humanity since early hominid times is suddenly eradicated by mysterious Earth forces. For the first time in its existence humanity stands as a fully independent species. But far from this being liberation, the “human system” is now left in a precarious state and complete collapse seems imminent. The sole surviving human/alien hybrid, the British Prime Minister and an aerobics instructor from Bermondsey attempt to make sense of the forthcoming catastrophe. Can an enigmatic crop circle reveal the way ahead?
The platform for gamers to play, connect, explore, and more. Explore, and more. Download now. Top gaming titles available only on Garena. Send messages instantly to your friends. Communicate through voice to get an edge over your opponents. Garena Mobile. This chat starter software download is currently available as version 2.0.3632. Compatibility may vary, but generally runs on a Microsoft Windows 10, Windows 8 or Windows 7 desktop and laptop PC. Garena Plus has been tested for viruses, please refer to the tests on the 'Virus Tests' page. It is published by Garena. Download Garena from official sites for free using QPDownload.com. Additional information about license you can found on owners sites. How do I access the free Garena download for PC? Just click the free Garena download button at the top left of the page. Clicking this link will start the installer to download Garena free for Windows.
Features
Garena is a product developed by Garena Online. This site is not directly affiliated with Garena Online. All trademarks, registered trademarks, product names and company names or logos mentioned herein are the property of their respective owners.
All informations about programs or games on this website have been found in open sources on the Internet. All programs and games not hosted on our site. When visitor click 'Download now' button files will downloading directly from official sources(owners sites). QP Download is strongly against the piracy, we do not support any manifestation of piracy. If you think that app/game you own the copyrights is listed on our website and you want to remove it, please contact us. We are DMCA-compliant and gladly to work with you. Please find the DMCA / Removal Request below.
DMCA / REMOVAL REQUEST
Please include the following information in your claim request:
Free access download. You may send an email to support [at] qpdownload.com for all DMCA / Removal Requests.
You can find a lot of useful information about the different software on our QP Download Blog page.
Latest Posts:
How do I uninstall Garena in Windows Vista / Windows 7 / Windows 8?
How do I uninstall Garena in Windows XP?
Download Garena Pc
Download sandisk u3 launchpad. How do I uninstall Garena in Windows 95, 98, Me, NT, 2000? Lenovo thinkpad t60 drivers.
Download mysql workbench windows, mysql workbench windows, mysql workbench windows download free. MySQL Workbench. MySQL Workbench. Share MySQL Workbench 6.3.4 (32-bit) with your friends. Discover our editors choices. The best games for Android launched during the first semester of 2019. Jun 03, 2010 Free mysql workbench 6.3 ce download software at UpdateStar. To be able to install and run MySQL Workbench on Windows your system needs to have libraries listed below installed. The listed items are provided as links to the corresponding download pages where you can fetch the necessary files. Mysql workbench 6 3 ce download; SHARE ON Twitter Facebook Google+ Pinterest. Tags: install mysql workbench mac, mysql download for windows 8 1 64 bit, MySQL Workbench, mysql workbench 5 7 download, mysql workbench download filehippo. Related Posts of 'Download MySQL Workbench 6.3.10'. Mar 19, 2019 We suggest that you use the MD5 checksums and GnuPG signatures to verify the integrity of the packages you download. MySQL open source software is provided under the GPL License. Contact MySQL Sales USA/Canada: +1-866-221-0634 ( More Countries » ). Mysql workbench 6.3 ce download.
Deep Learning Toolbox™ (formerly Neural Network Toolbox™) provides a framework for designing and implementing deep neural networks with algorithms, pretrained models, and apps. You can use convolutional neural networks (ConvNets, CNNs) and long short-term memory (LSTM) networks to perform classification and regression on image, time-series, and text data. You can build advanced network architectures such as generative adversarial networks (GANs) and Siamese networks using custom training loops, shared weights, and automatic differentiation. Apps and plots help you visualize activations, edit and analyze network architectures, and monitor training progress.
Download the latest HP PSC 2100 Series driver for your computer's operating system. All downloads available on this website have been scanned by the latest anti-virus software and are guaranteed to be virus and malware-free.
MySQL Workbench. Download MySQL Workbench – MySQL Workbench makes it possible for a DBA, designer, or data architect to visually design, produce, and handle all types of databases consisting of Web, OLTP, and data storehouse data sources.It consists of everything a data modeler needs for producing complicated ER versions, and likewise delivers vital functions for carrying out hard. Download mysql workbench windows, mysql workbench windows, mysql workbench windows download free. MySQL Workbench. MySQL Workbench. Share MySQL Workbench 6.3.4 (32-bit) with your friends. Discover our editors choices. The best games for Android launched during the first semester of 2019. MySQL Community Edition MySQL Community Edition is the freely downloadable version of the world's most popular open source database. It is available under the GPL license and is supported by a huge and active community of open source developers. Jun 03, 2010 Free mysql workbench 6.3 ce download software at UpdateStar.
Auto tune 7 free download for pc. Multimedia tools downloads - Antares Autotune VST by Antares Audio Technologies and many more programs are available for instant and free download.
List of Supreme Commander and Forged Alliance that is released to public:- Contentsshow Supreme Commander Patch versions 3217 Patch 3220 Patch GPGnet World Map Patch 3251 Patch 3254 Patch 3255 Patch 3260 Patch 3269 Patch 3280 Patch Incremental Patches 3217 to. Oct 28, 2016 Hi everyone, I am playing Supreme Commander Forged Alliance, however the Non-steam version that I purchased back in the day. Unfortunately, I just managed to updated manually to version 1.5.3599 - which is obviously not the most current patch. I am also facing some bugs in the campaign (like for example the plasma beams of the UEF battlecruiser not hitting anything) and I strongly.
Nov 19, 2012 ASSASSINS CREED REVELATIONS-SKIDROW update 1.02 + crack only By Unknown in 08:02 November 19, 2012. In Assassin’s Creed® Revelations, master assassin Ezio Auditore walks in the footsteps of the legendary mentor Altair, on a journey of discovery and revelation. We had to use an additional way to crack this, because if you went back.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |