{"product_id":"designing-with-objects-isbn-9781118581209","title":"Designing with Objects","description":"\u003cp\u003e\u003cb\u003eHere is a book that takes the sting out of learning object-oriented design patterns! Using vignettes from the fictional world of Harry Potter, author Avinash C. Kak provides a refreshing alternative to the typically abstract and dry object-oriented design literature.\u003cbr\u003e \u003cbr\u003e \u003c\/b\u003e\u003ci\u003eDesigning with Objects\u003c\/i\u003e is unique. It explains design patterns using the short-story medium instead of sterile examples. It is the third volume in a trilogy by Avinash C. Kak, following Programming with Objects (Wiley, 2003) and Scripting with Objects (Wiley, 2008). \u003ci\u003eDesigning with Objects\u003c\/i\u003e confronts how difficult it is for students to learn complex patterns based on conventional scenarios that they may not be able to relate to. In contrast, it shows that stories from the fictional world of Harry Potter provide highly relatable and engaging models. After explaining core notions in a pattern and its typical use in real-world applications, each chapter shows how a pattern can be mapped to a Harry Potter story. The next step is an explanation of the pattern through its Java implementation. The following patterns appear in three sections: Abstract Factory, Builder, Factory Method, Prototype, and Singleton; Adapter, Bridge, Composite, Decorator, Facade, Flyweight, and Proxy; and the Chain of Responsibility, Command, Interpreter, Iterator, Mediator, Memento, Observer, State, Strategy, Template Method, and Visitor. For readers’ use, Java code for each pattern is included in the book’s companion website.\u003cbr\u003e \u003cbr\u003e \u003c\/p\u003e \u003cul\u003e \u003cli\u003eAll code examples in the book are available for download on a companion website with resources for readers and instructors.\u003c\/li\u003e \u003cli\u003eA refreshing alternative to the abstract and dry explanations of the object-oriented design patterns in much of the existing literature on the subject.\u003c\/li\u003e \u003cli\u003eIn 24 chapters, Designing with Objects explains well-known design patterns by relating them to stories from the fictional Harry Potter series\u003c\/li\u003e \u003c\/ul\u003e  \u003cp\u003ePREFACE xiv\u003c\/p\u003e \u003cp\u003eACKNOWLEDGMENTS xix\u003c\/p\u003e \u003cp\u003e\u003cb\u003e1 Why Learn Design Patterns and Why Do So with Help from Harry Potter? 1\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003e1.1 The OO Design Patterns “Bible” by GoF 2\u003c\/p\u003e \u003cp\u003e1.2 But What Has Harry Potter Got to Do with OO Design Patterns? 4\u003c\/p\u003e \u003cp\u003e1.3 Is Familiarity with Harry Potter a Requirement for Understanding This Book? 6\u003c\/p\u003e \u003cp\u003e1.4 How the Pattern Explanations are Organized 7\u003c\/p\u003e \u003cp\u003e1.5 The Terminology of Object-Oriented Programming 7\u003c\/p\u003e \u003cp\u003e1.6 The UML Notation Used in the Class Diagrams 12\u003c\/p\u003e \u003cp\u003e1.6.1 Association as a Relationship Between Classes 14\u003c\/p\u003e \u003cp\u003e1.6.2 Aggregation and Composition as Relationships Between Classes 15\u003c\/p\u003e \u003cp\u003e1.6.3 Representing Attributes 16\u003c\/p\u003e \u003cp\u003e1.6.4 Representing Operations 17\u003c\/p\u003e \u003cp\u003e\u003cb\u003eI CREATIONAL PATTERNS 19\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003e\u003cb\u003e2 Abstract Factory 21\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003e2.1 The Concept of a Factory in Software 21\u003c\/p\u003e \u003cp\u003e2.2 Intent and Applicability 22\u003c\/p\u003e \u003cp\u003e2.3 Introduction to the Abstract Factory Pattern 22\u003c\/p\u003e \u003cp\u003e2.4 The Abstract Factory Pattern in Real-World Applications 23\u003c\/p\u003e \u003cp\u003e2.5 Harry Potter Story Used to Illustrate the Abstract Factory Pattern 23\u003c\/p\u003e \u003cp\u003e2.6 A Top Level View of the Pattern Demonstration 25\u003c\/p\u003e \u003cp\u003e2.7 The Abstract Class Factory 27\u003c\/p\u003e \u003cp\u003e2.8 The Helper Class FactoryStore 27\u003c\/p\u003e \u003cp\u003e2.9 The Abstract Class Enchanted 30\u003c\/p\u003e \u003cp\u003e2.10 The Concrete Classes for Magical Objects 31\u003c\/p\u003e \u003cp\u003e2.11 The Concrete Factory Classes 32\u003c\/p\u003e \u003cp\u003e2.12 The Client Class Diagon AlleyRetailer 34\u003c\/p\u003e \u003cp\u003e2.13 Playing with the Code 36\u003c\/p\u003e \u003cp\u003e\u003cb\u003e3 Builder 38\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003e3.1 Building Complex Objects 38\u003c\/p\u003e \u003cp\u003e3.2 Intent and Applicability 39\u003c\/p\u003e \u003cp\u003e3.3 Introduction to the Builder Pattern 39\u003c\/p\u003e \u003cp\u003e3.4 The Builder Pattern in Real-World Applications 41\u003c\/p\u003e \u003cp\u003e3.5 Harry Potter Story Used to Illustrate the Builder Pattern 42\u003c\/p\u003e \u003cp\u003e3.6 A Top-Level View of the Pattern Demonstration 43\u003c\/p\u003e \u003cp\u003e3.7 The Abstract Class PotionMaker 45\u003c\/p\u003e \u003cp\u003e3.8 The Concrete Extensions of PotionMaker 46\u003c\/p\u003e \u003cp\u003e3.9 The Director Class 52\u003c\/p\u003e \u003cp\u003e3.10 The Potion Class 54\u003c\/p\u003e \u003cp\u003e3.11 The Ingredient Class 55\u003c\/p\u003e \u003cp\u003e3.12 The PotionMakingFeasibilityViolation Class 55\u003c\/p\u003e \u003cp\u003e3.13 The Client Class 55\u003c\/p\u003e \u003cp\u003e3.14 Playing with the Code 56\u003c\/p\u003e \u003cp\u003e\u003cb\u003e4 Factory Method 59\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003e4.1 Revisiting the Concept of a Factory in Software 59\u003c\/p\u003e \u003cp\u003e4.2 Intent and Applicability 60\u003c\/p\u003e \u003cp\u003e4.3 Introduction to the Factory Method Pattern 60\u003c\/p\u003e \u003cp\u003e4.4 The Factory Method Pattern in Real-World Applications 61\u003c\/p\u003e \u003cp\u003e4.5 Harry Potter Story Used to Illustrate the Factory Method Pattern 62\u003c\/p\u003e \u003cp\u003e4.6 A Top Level View of the Pattern Demonstration 63\u003c\/p\u003e \u003cp\u003e4.7 The Enchanted Class Hierarchy 65\u003c\/p\u003e \u003cp\u003e4.8 The ArtifactFactory Class Hierarchy and the Factory Methods Contained Therein 68\u003c\/p\u003e \u003cp\u003e4.9 The Client Class 70\u003c\/p\u003e \u003cp\u003e4.10 Playing with the Code 71\u003c\/p\u003e \u003cp\u003e\u003cb\u003e5 Prototype 73\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003e5.1 Why Not Make New Objects by Copying Old Objects? 73\u003c\/p\u003e \u003cp\u003e5.2 Intent and Applicability 74\u003c\/p\u003e \u003cp\u003e5.3 Introduction to the Prototype Pattern 74\u003c\/p\u003e \u003cp\u003e5.4 The Prototype Pattern in Real-World Applications 77\u003c\/p\u003e \u003cp\u003e5.5 Harry Potter Story Used to Illustrate The Prototype Pattern 78\u003c\/p\u003e \u003cp\u003e5.6 A Top Level View of the Pattern Demonstration 79\u003c\/p\u003e \u003cp\u003e5.7 The Dragon Class 81\u003c\/p\u003e \u003cp\u003e5.8 The PrototypeManagerAndDuplicator Class 84\u003c\/p\u003e \u003cp\u003e5.9 The DragonAficionado Class 87\u003c\/p\u003e \u003cp\u003e5.10 The UnknownDragonException Class 88\u003c\/p\u003e \u003cp\u003e5.11 Playing with the Code 88\u003c\/p\u003e \u003cp\u003e\u003cb\u003e6 Singleton 90\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003e6.1 Singular Objects 90\u003c\/p\u003e \u003cp\u003e6.2 Intent and Applicability 90\u003c\/p\u003e \u003cp\u003e6.3 Introduction to the Singleton Pattern 91\u003c\/p\u003e \u003cp\u003e6.4 The Singleton Pattern in Real-World Applications 91\u003c\/p\u003e \u003cp\u003e6.5 Harry Potter Story Used to Illustrate the Singleton Pattern 92\u003c\/p\u003e \u003cp\u003e6.6 A Top Level View of the Pattern Demonstration 92\u003c\/p\u003e \u003cp\u003e6.7 The MinisterForMagic Class 93\u003c\/p\u003e \u003cp\u003e6.8 The TestSingleton Class 94\u003c\/p\u003e \u003cp\u003e6.9 Variations on the Singleton Pattern 95\u003c\/p\u003e \u003cp\u003e6.10 Playing with the Code 97\u003c\/p\u003e \u003cp\u003e\u003cb\u003eII STRUCTURAL PATTERNS 99\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003e\u003cb\u003e7 Adapter 101\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003e7.1 Getting Things to Work Together 101\u003c\/p\u003e \u003cp\u003e7.2 Intent and Applicability 102\u003c\/p\u003e \u003cp\u003e7.3 Introduction to the Adapter Pattern 102\u003c\/p\u003e \u003cp\u003e7.4 The Adapter Pattern in Real-World Applications 103\u003c\/p\u003e \u003cp\u003e7.5 Harry Potter Story Used to Illustrate the Adapter Pattern 104\u003c\/p\u003e \u003cp\u003e7.6 A Top Level View of the Pattern Demonstration 104\u003c\/p\u003e \u003cp\u003e7.7 The Target Interface: TeachingDADA 106\u003c\/p\u003e \u003cp\u003e7.8 The TeacherForDADA Class 107\u003c\/p\u003e \u003cp\u003e7.9 The AdapterForSafeTeaching Class 108\u003c\/p\u003e \u003cp\u003e7.10 The Client Class SchoolOfMagic 110\u003c\/p\u003e \u003cp\u003e7.11 Object Adapter 111\u003c\/p\u003e \u003cp\u003e7.12 Pluggable Adapter 113\u003c\/p\u003e \u003cp\u003e7.13 Playing with the Code 119\u003c\/p\u003e \u003cp\u003e\u003cb\u003e8 Bridge 122\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003e8.1 Concepts and Their Implementation 122\u003c\/p\u003e \u003cp\u003e8.2 Intent and Applicability 123\u003c\/p\u003e \u003cp\u003e8.3 Introduction to the Bridge Pattern 123\u003c\/p\u003e \u003cp\u003e8.4 The Bridge Pattern in Real-World Applications 126\u003c\/p\u003e \u003cp\u003e8.5 Harry Potter Story Used to Illustrate the Bridge Pattern 127\u003c\/p\u003e \u003cp\u003e8.6 A Top Level View of the Pattern Demonstration 130\u003c\/p\u003e \u003cp\u003e8.7 The Humanoid Class 130\u003c\/p\u003e \u003cp\u003e8.8 The Dementor, Goblin, and HouseElf Classes 132\u003c\/p\u003e \u003cp\u003e8.9 The Humanoid Imp Class 134\u003c\/p\u003e \u003cp\u003e8.10 Implementation Classes for the Dementor, Goblin, and HouseElf Classes 137\u003c\/p\u003e \u003cp\u003e8.11 The Client Class MinistryOfMagic 139\u003c\/p\u003e \u003cp\u003e8.12 Playing with the Code 140\u003c\/p\u003e \u003cp\u003e\u003cb\u003e9 Composite 142\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003e9.1 Relationships That Loop Back 142\u003c\/p\u003e \u003cp\u003e9.2 Intent and Applicability 143\u003c\/p\u003e \u003cp\u003e9.3 Introduction to the Composite Pattern 144\u003c\/p\u003e \u003cp\u003e9.4 The Composite Pattern in Real-World Applications 145\u003c\/p\u003e \u003cp\u003e9.5 Harry Potter Story Used to Illustrate the Composite Pattern 146\u003c\/p\u003e \u003cp\u003e9.6 A Top Level View of the Pattern Demonstration 147\u003c\/p\u003e \u003cp\u003e9.7 The WizardTraits Interface 148\u003c\/p\u003e \u003cp\u003e9.8 The Wizard Class 149\u003c\/p\u003e \u003cp\u003e9.9 The Auror Class 152\u003c\/p\u003e \u003cp\u003e9.10 The Obliviator Class 153\u003c\/p\u003e \u003cp\u003e9.11 The DepartmentHead Class 155\u003c\/p\u003e \u003cp\u003e9.12 The Minister for Magic Class 156\u003c\/p\u003e \u003cp\u003e9.13 The Client Class Test 158\u003c\/p\u003e \u003cp\u003e9.14 Playing with the Code 159\u003c\/p\u003e \u003cp\u003e\u003cb\u003e10 Decorator 161\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003e10.1 Onion as a Metaphor 161\u003c\/p\u003e \u003cp\u003e10.2 Intent and Applicability 162\u003c\/p\u003e \u003cp\u003e10.3 Introduction to the Decorator Pattern 162\u003c\/p\u003e \u003cp\u003e10.4 The Decorator Pattern in Real-World Applications 164\u003c\/p\u003e \u003cp\u003e10.5 Harry Potter Story Used to Illustrate the Decorator Pattern 165\u003c\/p\u003e \u003cp\u003e10.6 A Top Level View of the Pattern Demonstration 168\u003c\/p\u003e \u003cp\u003e10.7 The CoreMessageDeliveryClass Class 170\u003c\/p\u003e \u003cp\u003e10.8 The Decorator Classes 170\u003c\/p\u003e \u003cp\u003e10.9 The Client Class Test 172\u003c\/p\u003e \u003cp\u003e10.10 Playing with the Code 173\u003c\/p\u003e \u003cp\u003e\u003cb\u003e11 Facade 175\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003e11.1 Hiding Complexity 175\u003c\/p\u003e \u003cp\u003e11.2 Intent and Applicability 175\u003c\/p\u003e \u003cp\u003e11.3 Introduction to the Facade Pattern 176\u003c\/p\u003e \u003cp\u003e11.4 The Facade Pattern in Real-World Applications 177\u003c\/p\u003e \u003cp\u003e11.5 Harry Potter Story Used to Illustrate the Facade Pattern 177\u003c\/p\u003e \u003cp\u003e11.6 A Top Level View of the Pattern Demonstration 179\u003c\/p\u003e \u003cp\u003e11.7 The Abstract Root Class Facade 181\u003c\/p\u003e \u003cp\u003e11.8 The Network Class 183\u003c\/p\u003e \u003cp\u003e11.9 The Node, Link, and Path Classes 193\u003c\/p\u003e \u003cp\u003e11.10 The Three Concrete Facade Classes 198\u003c\/p\u003e \u003cp\u003e11.11 Testing the Demonstration Code 203\u003c\/p\u003e \u003cp\u003e11.12 Playing with the Code 207\u003c\/p\u003e \u003cp\u003e\u003cb\u003e12 Flyweight 212\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003e12.1 The Idea of Customized Duplications 212\u003c\/p\u003e \u003cp\u003e12.2 Intent and Applicability 213\u003c\/p\u003e \u003cp\u003e12.3 Introduction to the Flyweight Pattern 213\u003c\/p\u003e \u003cp\u003e12.4 The Flyweight Pattern in Real-World Applications 214\u003c\/p\u003e \u003cp\u003e12.5 Harry Potter Story Used to Illustrate the Flyweight Pattern 214\u003c\/p\u003e \u003cp\u003e12.6 A Top Level View of the Pattern Demonstration 215\u003c\/p\u003e \u003cp\u003e12.7 The HeadMasterPortrait Class 218\u003c\/p\u003e \u003cp\u003e12.8 The FlyweightImageStore Class 218\u003c\/p\u003e \u003cp\u003e12.9 The ImageManager Class 219\u003c\/p\u003e \u003cp\u003e12.10 The PortraitBorderChoices Class 225\u003c\/p\u003e \u003cp\u003e12.11 The ImageNotAvailableException Class 226\u003c\/p\u003e \u003cp\u003e12.12 The PortraitMakerAssignment Class 226\u003c\/p\u003e \u003cp\u003e12.13 Playing with the Code 228\u003c\/p\u003e \u003cp\u003e12.14 Acknowledgment 229\u003c\/p\u003e \u003cp\u003e\u003cb\u003e13 Proxy 230\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003e13.1 Is It Always Necessary to Have the Real Thing? 230\u003c\/p\u003e \u003cp\u003e13.2 Intent and Applicability 230\u003c\/p\u003e \u003cp\u003e13.3 Introduction to the Proxy Pattern 231\u003c\/p\u003e \u003cp\u003e13.4 The Proxy Pattern in Real-World Applications 232\u003c\/p\u003e \u003cp\u003e13.5 Harry Potter Story Used to Illustrate the Proxy Pattern 233\u003c\/p\u003e \u003cp\u003e13.6 A Top Level View of the Pattern Demonstration 235\u003c\/p\u003e \u003cp\u003e13.7 The Abstract Class Wizard 235\u003c\/p\u003e \u003cp\u003e13.8 The DarkWizardTraits Interface 237\u003c\/p\u003e \u003cp\u003e13.9 The DarkWizard Class 238\u003c\/p\u003e \u003cp\u003e13.10 The DarkLord Class 242\u003c\/p\u003e \u003cp\u003e13.11 The ClientClass Class 245\u003c\/p\u003e \u003cp\u003e13.12 Playing with the Code 246\u003c\/p\u003e \u003cp\u003e\u003cb\u003eIII BEHAVIORAL PATTERNS 249\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003e\u003cb\u003e14 Chain of Responsibility 253\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003e14.1 Passing the Buck 253\u003c\/p\u003e \u003cp\u003e14.2 Intent and Applicability 254\u003c\/p\u003e \u003cp\u003e14.3 Introduction to the Chain of Responsibility Pattern 254\u003c\/p\u003e \u003cp\u003e14.4 The Chain of Responsibility Pattern in Real-World Applications 255\u003c\/p\u003e \u003cp\u003e14.5 Harry Potter Story Used to Illustrate the Chain of Responsibility Pattern 256\u003c\/p\u003e \u003cp\u003e14.6 A Top Level View of the Pattern Demonstration 258\u003c\/p\u003e \u003cp\u003e14.7 The Interface Class Violations 260\u003c\/p\u003e \u003cp\u003e14.8 The Abstract Class Adjudicator 261\u003c\/p\u003e \u003cp\u003e14.9 The Player Class 263\u003c\/p\u003e \u003cp\u003e14.10 The Classes with the Authority to Resolve Violations 265\u003c\/p\u003e \u003cp\u003e14.11 Testing the Code 268\u003c\/p\u003e \u003cp\u003e14.12 Playing with the Code 269\u003c\/p\u003e \u003cp\u003e\u003cb\u003e15 Command 272\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003e15.1 Actions Versus the Actors 272\u003c\/p\u003e \u003cp\u003e15.2 Intent and Applicability 273\u003c\/p\u003e \u003cp\u003e15.3 Introduction to the Command Pattern 274\u003c\/p\u003e \u003cp\u003e15.4 The Command Pattern in Real-World Applications 274\u003c\/p\u003e \u003cp\u003e15.5 Harry Potter Story Used to Illustrate the Command Pattern 276\u003c\/p\u003e \u003cp\u003e15.6 A Top Level View of the Pattern Demonstration 277\u003c\/p\u003e \u003cp\u003e15.7 The Command Interface 279\u003c\/p\u003e \u003cp\u003e15.8 The MyPlaces Interface 279\u003c\/p\u003e \u003cp\u003e15.9 The ProtectHarryPotter Class 279\u003c\/p\u003e \u003cp\u003e15.10 The Wizard Class 282\u003c\/p\u003e \u003cp\u003e15.11 The Squib Class 284\u003c\/p\u003e \u003cp\u003e15.12 The Invoker Class 285\u003c\/p\u003e \u003cp\u003e15.13 The UnableToProtectHarryPotterException Class 286\u003c\/p\u003e \u003cp\u003e15.14 The Client Class 286\u003c\/p\u003e \u003cp\u003e15.15 Playing with the Code 288\u003c\/p\u003e \u003cp\u003e\u003cb\u003e16 Interpreter 290\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003e16.1 Parsing versus Interpretation 290\u003c\/p\u003e \u003cp\u003e16.2 Intent and Applicability 292\u003c\/p\u003e \u003cp\u003e16.3 Introduction to the Interpreter Pattern 292\u003c\/p\u003e \u003cp\u003e16.4 The Interpreter Pattern in Real-World Applications 293\u003c\/p\u003e \u003cp\u003e16.5 Harry Potter Story Used to Illustrate the Interpreter Pattern 294\u003c\/p\u003e \u003cp\u003e16.6 A Parser Front-End for the Interpreter Pattern 296\u003c\/p\u003e \u003cp\u003e16.7 A Top Level View of the Pattern Demonstration 304\u003c\/p\u003e \u003cp\u003e16.8 The Driver Class 307\u003c\/p\u003e \u003cp\u003e16.9 The Interpreter Sentence Class 310\u003c\/p\u003e \u003cp\u003e16.10 The Worker Classes for Interpretation 312\u003c\/p\u003e \u003cp\u003e16.11 The Utility Class ShowSyntaxTree 315\u003c\/p\u003e \u003cp\u003e16.12 Playing with the Code 316\u003c\/p\u003e \u003cp\u003e\u003cb\u003e17 Iterator 321\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003e17.1 Storing Object Collections and Interacting with Them 321\u003c\/p\u003e \u003cp\u003e17.2 Intent and Applicability 323\u003c\/p\u003e \u003cp\u003e17.3 Introduction to the Iterator Pattern 323\u003c\/p\u003e \u003cp\u003e17.4 The Iterator Pattern in Real-World Applications 324\u003c\/p\u003e \u003cp\u003e17.5 Harry Potter Story Used to Illustrate the Iterator Pattern 325\u003c\/p\u003e \u003cp\u003e17.6 A Top Level View of the Pattern Demonstration 326\u003c\/p\u003e \u003cp\u003e17.7 A Utility Interface for Demonstrating the Iterator Pattern 328\u003c\/p\u003e \u003cp\u003e17.8 The Iterator Interface 330\u003c\/p\u003e \u003cp\u003e17.9 The Fresher Class 330\u003c\/p\u003e \u003cp\u003e17.10 The SortingHat Class 334\u003c\/p\u003e \u003cp\u003e17.11 The MagicCollection Interface 344\u003c\/p\u003e \u003cp\u003e17.12 The MagicList and MagicSet Classes 344\u003c\/p\u003e \u003cp\u003e17.13 The Class Range 349\u003c\/p\u003e \u003cp\u003e17.14 Playing with the Code 349\u003c\/p\u003e \u003cp\u003e17.15 Credits 352\u003c\/p\u003e \u003cp\u003e\u003cb\u003e18 Mediator 353\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003e18.1 The Role of Mediation in Collaborative Problem Solving 353\u003c\/p\u003e \u003cp\u003e18.2 Intent and Applicability 354\u003c\/p\u003e \u003cp\u003e18.3 Introduction to the Mediator Pattern 354\u003c\/p\u003e \u003cp\u003e18.4 The Mediator Pattern in Real-World Applications 355\u003c\/p\u003e \u003cp\u003e18.5 Harry Potter Story Used to Illustrate the Mediator Pattern 357\u003c\/p\u003e \u003cp\u003e18.6 A Top Level View of the Pattern Demonstration 357\u003c\/p\u003e \u003cp\u003e18.7 The Abstract Class Mediator 359\u003c\/p\u003e \u003cp\u003e18.8 The Interface TrialElements 360\u003c\/p\u003e \u003cp\u003e18.9 The MinistryOfMagicTrialMediator Class 361\u003c\/p\u003e \u003cp\u003e18.10 The Witness Class 366\u003c\/p\u003e \u003cp\u003e18.11 The Trial Interface 367\u003c\/p\u003e \u003cp\u003e18.12 The HarryPotterTrial Class 367\u003c\/p\u003e \u003cp\u003e18.13 Playing with the Code 369\u003c\/p\u003e \u003cp\u003e\u003cb\u003e19 Memento 371\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003e19.1 Recalling the Past 371\u003c\/p\u003e \u003cp\u003e19.2 Intent and Applicability 372\u003c\/p\u003e \u003cp\u003e19.3 Introduction to the Memento Pattern 372\u003c\/p\u003e \u003cp\u003e19.4 The Memento Pattern in Real-World Applications 374\u003c\/p\u003e \u003cp\u003e19.5 Harry Potter Story Used to Illustrate the Memento Pattern 374\u003c\/p\u003e \u003cp\u003e19.6 A Top Level View of the Pattern Demonstration 377\u003c\/p\u003e \u003cp\u003e19.7 The HogwartsHappening Class and The Inner Memento Class 378\u003c\/p\u003e \u003cp\u003e19.8 The Client Class 380\u003c\/p\u003e \u003cp\u003e19.9 Playing with the Code 384\u003c\/p\u003e \u003cp\u003e\u003cb\u003e20 Observer 386\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003e20.1 Subscription-Based Broadcasting 386\u003c\/p\u003e \u003cp\u003e20.2 Intent and Applicability 387\u003c\/p\u003e \u003cp\u003e20.3 Introduction to the Observer Pattern 387\u003c\/p\u003e \u003cp\u003e20.4 The Observer Pattern in Real-World Applications 388\u003c\/p\u003e \u003cp\u003e20.5 Harry Potter Story Used to Illustrate the Observer Pattern 389\u003c\/p\u003e \u003cp\u003e20.6 A Top Level View of the Pattern Demonstration 391\u003c\/p\u003e \u003cp\u003e20.7 The Observer Interface 391\u003c\/p\u003e \u003cp\u003e20.8 The Observable Interface 393\u003c\/p\u003e \u003cp\u003e20.9 The DarkLord Class 393\u003c\/p\u003e \u003cp\u003e20.10 The DeathEater Class 396\u003c\/p\u003e \u003cp\u003e20.11 The GodProcess Class 399\u003c\/p\u003e \u003cp\u003e20.12 Playing with the Code 401\u003c\/p\u003e \u003cp\u003e\u003cb\u003e21 State 405\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003e21.1 Contextual Dependence of Behaviors 405\u003c\/p\u003e \u003cp\u003e21.2 Intent and Applicability 406\u003c\/p\u003e \u003cp\u003e21.3 Introduction to the State Pattern 406\u003c\/p\u003e \u003cp\u003e21.4 The State Pattern in Real-World Applications 406\u003c\/p\u003e \u003cp\u003e21.5 Harry Potter Story Used to Illustrate the State Pattern 407\u003c\/p\u003e \u003cp\u003e21.6 A Top Level View of the Pattern Demonstration 408\u003c\/p\u003e \u003cp\u003e21.7 The DADA State Interface 410\u003c\/p\u003e \u003cp\u003e21.8 The Year-by-Year Implementation Classes for the State 411\u003c\/p\u003e \u003cp\u003e21.9 The TeachingDADA Class 417\u003c\/p\u003e \u003cp\u003e21.10 The Hogwarts Class 418\u003c\/p\u003e \u003cp\u003e21.11 Playing with the Code 419\u003c\/p\u003e \u003cp\u003e\u003cb\u003e22 Strategy 421\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003e22.1 Strategies in the Pursuit of Goals 421\u003c\/p\u003e \u003cp\u003e22.2 Intent and Applicability 422\u003c\/p\u003e \u003cp\u003e22.3 Introduction to the Strategy Pattern 422\u003c\/p\u003e \u003cp\u003e22.4 The Strategy Pattern in Real-World Applications 423\u003c\/p\u003e \u003cp\u003e22.5 Harry Potter Story Used to Illustrate the Strategy Pattern 424\u003c\/p\u003e \u003cp\u003e22.6 A Top Level View of the Pattern Demonstration 425\u003c\/p\u003e \u003cp\u003e22.7 The Abstract Root Class for Strategies: StrategyAbstractRoot 428\u003c\/p\u003e \u003cp\u003e22.8 The Concrete Strategy Classes 429\u003c\/p\u003e \u003cp\u003e22.9 The Champion Class 432\u003c\/p\u003e \u003cp\u003e22.10 The SecondTaskManager Class 434\u003c\/p\u003e \u003cp\u003e22.11 Playing with the Code 436\u003c\/p\u003e \u003cp\u003e\u003cb\u003e23 Template Method 437\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003e23.1 Customizable Recipes 437\u003c\/p\u003e \u003cp\u003e23.2 Intent and Applicability 438\u003c\/p\u003e \u003cp\u003e23.3 Introduction to the Template Method Pattern 438\u003c\/p\u003e \u003cp\u003e23.4 The Template Method Pattern in Real-World Applications 440\u003c\/p\u003e \u003cp\u003e23.5 Harry Potter Story Used to Illustrate the Template Method Pattern 441\u003c\/p\u003e \u003cp\u003e23.6 A Top Level View of the Pattern Demonstration 442\u003c\/p\u003e \u003cp\u003e23.7 The Abstract Root of Narrative Generation Classes 444\u003c\/p\u003e \u003cp\u003e23.8 Concrete Classes for Narrative Generation 445\u003c\/p\u003e \u003cp\u003e23.9 The Executable Class 449\u003c\/p\u003e \u003cp\u003e23.10 Playing with the Code 450\u003c\/p\u003e \u003cp\u003e\u003cb\u003e24 Visitor 453\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003e24.1 Hooks, Good and Evil 453\u003c\/p\u003e \u003cp\u003e24.2 Intent and Applicability 454\u003c\/p\u003e \u003cp\u003e24.3 Introduction to the Visitor Pattern 454\u003c\/p\u003e \u003cp\u003e24.4 The Visitor Pattern in Real-World Applications 457\u003c\/p\u003e \u003cp\u003e24.5 Harry Potter Story Used to Illustrate the Visitor Pattern 457\u003c\/p\u003e \u003cp\u003e24.6 A Top Level View of the Pattern Demonstration 459\u003c\/p\u003e \u003cp\u003e24.7 The Visitor Interface 460\u003c\/p\u003e \u003cp\u003e24.8 Two Concrete Implementations of the Visitor Interface 462\u003c\/p\u003e \u003cp\u003e24.9 A Re-Implementation of the Wizard Hierarchy of the Composite Pattern 463\u003c\/p\u003e \u003cp\u003e24.10 The Executable Class Client 469\u003c\/p\u003e \u003cp\u003e24.11 Playing with the Code 470\u003c\/p\u003e \u003cp\u003eREFERENCES 473\u003c\/p\u003e \u003cp\u003eINDEX 474\u003c\/p\u003e  \u003cp\u003e\u003cb\u003eAvinash C. Kak\u003c\/b\u003e is Professor of Electrical and Computer Engineering at Purdue University. His areas of interest include software engineering, computer and network security, sensor networks, and computer vision (especially with camera networks). Professor Kak has been awarded numerous Best Teacher of the Year awards at Purdue University. He is the author of \u003cb\u003eScripting with Objects \u003c\/b\u003eand \u003cb\u003eProgramming with Objects\u003c\/b\u003e, both published by Wiley.\u003c\/p\u003e  \u003cp\u003e\u003cb\u003eHere is a book that takes the sting out of learning object-oriented design patterns! Using vignettes from the fictional world of Harry Potter, author Avinash C. Kak provides a refreshing alternative to the typically abstract and dry object-oriented design literature.\u003cbr\u003e \u003cbr\u003e \u003c\/b\u003e\u003ci\u003eDesigning with Objects\u003c\/i\u003e is unique. It explains design patterns using the short-story medium instead of sterile examples. It is the third volume in a trilogy by Avinash C. Kak, following Programming with Objects (Wiley, 2003) and Scripting with Objects (Wiley, 2008). \u003ci\u003eDesigning with Objects\u003c\/i\u003e confronts how difficult it is for students to learn complex patterns based on conventional scenarios that they may not be able to relate to. In contrast, it shows that stories from the fictional world of Harry Potter provide highly relatable and engaging models. After explaining core notions in a pattern and its typical use in real-world applications, each chapter shows how a pattern can be mapped to a Harry Potter story. The next step is an explanation of the pattern through its Java implementation. The following patterns appear in three sections: Abstract Factory, Builder, Factory Method, Prototype, and Singleton; Adapter, Bridge, Composite, Decorator, Facade, Flyweight, and Proxy; and the Chain of Responsibility, Command, Interpreter, Iterator, Mediator, Memento, Observer, State, Strategy, Template Method, and Visitor. For readers’ use, Java code for each pattern is included in the book’s companion website.\u003cbr\u003e \u003cbr\u003e \u003c\/p\u003e \u003cul\u003e \u003cli\u003eAll code examples in the book are available for download on a companion website with resources for readers and instructors.\u003c\/li\u003e \u003cli\u003eA refreshing alternative to the abstract and dry explanations of the object-oriented design patterns in much of the existing literature on the subject.\u003c\/li\u003e \u003cli\u003eIn 24 chapters, Designing with Objects explains well-known design patterns by relating them to stories from the fictional Harry Potter series.\u003c\/li\u003e \u003c\/ul\u003e","brand":"Wiley","offers":[{"title":"Default Title","offer_id":47989050409189,"sku":"NP9781118581209","price":94.95,"currency_code":"USD","in_stock":false}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/1842\/7735\/files\/9781118581209.jpg?v=1761782588","url":"https:\/\/k12savings.com\/products\/designing-with-objects-isbn-9781118581209","provider":"K12savings","version":"1.0","type":"link"}