Writing your own Java I/O Decorator p. 102 Tools for your Design Toolbox p. 105 Exercise Solutions p. 106 The Factory Pattern Baking with OO

Similar documents
Table of Contents (summary) Table of Contents (the real thing)

The Strategy Pattern Design Principle: Design Principle: Design Principle:

Introduction to Software Engineering: Object Design I Reuse & Patterns

TDDB84. Lecture 2. fredag 6 september 13

CSCD01 Engineering Large Software Systems. Design Patterns. Joe Bettridge. Winter With thanks to Anya Tafliovich

SDC Design patterns GoF

TDDB84: Lecture 6. Adapter, Bridge, Observer, Chain of Responsibility, Memento, Command. fredag 4 oktober 13

UNIT I Introduction to Design Patterns

EPL 603 TOPICS IN SOFTWARE ENGINEERING. Lab 6: Design Patterns

SYLLABUS CHAPTER - 1 [SOFTWARE REUSE SUCCESS FACTORS] Reuse Driven Software Engineering is a Business

UNIT I Introduction to Design Patterns

Design Pattern. CMPSC 487 Lecture 10 Topics: Design Patterns: Elements of Reusable Object-Oriented Software (Gamma, et al.)

Software Design COSC 4353/6353 D R. R A J S I N G H

Ingegneria del Software Corso di Laurea in Informatica per il Management. Design Patterns part 1

Design Patterns. Manuel Mastrofini. Systems Engineering and Web Services. University of Rome Tor Vergata June 2011

CSCD01 Engineering Large Software Systems. Design Patterns. Joe Bettridge. Winter With thanks to Anya Tafliovich

The Design Patterns Matrix From Analysis to Implementation

A few important patterns and their connections

Plan. A few important patterns and their connections. Singleton. Singleton: class diagram. Singleton Factory method Facade

What is Design Patterns?

Object Oriented Methods with UML. Introduction to Design Patterns- Lecture 8

CSCI Object Oriented Design: Frameworks and Design Patterns George Blankenship. Frameworks and Design George Blankenship 1

Produced by. Design Patterns. MSc in Communications Software. Eamonn de Leastar

Modellistica Medica. Maria Grazia Pia, INFN Genova. Scuola di Specializzazione in Fisica Sanitaria Genova Anno Accademico

Design Patterns. Observations. Electrical Engineering Patterns. Mechanical Engineering Patterns

Design Patterns: Structural and Behavioural

Trusted Components. Reuse, Contracts and Patterns. Prof. Dr. Bertrand Meyer Dr. Karine Arnout

Object-oriented Software Design Patterns

DESIGN PATTERN - INTERVIEW QUESTIONS

OODP Session 4. Web Page: Visiting Hours: Tuesday 17:00 to 19:00

CSC207H: Software Design Lecture 6

CSCI 253. Overview. The Elements of a Design Pattern. George Blankenship 1. Object Oriented Design: Iterator Pattern George Blankenship

1 Software Architecture

Pro Objective-C Design Patterns for ios

Design Pattern What is a Design Pattern? Design Pattern Elements. Almas Ansari Page 1

CSCI 253. Overview. The Elements of a Design Pattern. George Blankenship 1. Object Oriented Design: Template Method Pattern. George Blankenship

Using Design Patterns in Java Application Development

CSE 70 Final Exam Fall 2009

A Reconnaissance on Design Patterns

Object-Oriented Oriented Programming

Applying Design Patterns to SCA Implementations

Application Architectures, Design Patterns

Socket attaches to a Ratchet. 2) Bridge Decouple an abstraction from its implementation so that the two can vary independently.

Design Patterns. (and anti-patterns)

Design patterns. Jef De Smedt Beta VZW

Design Patterns Reid Holmes

Applying the Decorator Design Pattern

Design Pattern and Software Architecture: IV. Design Pattern

CS/CE 2336 Computer Science II

Tuesday, October 4. Announcements

Applying the Observer Design Pattern

CSCD01 Engineering Large Software Systems. Design Patterns. Joe Bettridge. Winter With thanks to Anya Tafliovich

Lecture 4: Observer Pattern, Event Library and Componentization

TDDB84: Lecture 09. SOLID, Language design, Summary. fredag 11 oktober 13

3 Product Management Anti-Patterns by Thomas Schranz

Overview of Patterns: Introduction

Ingegneria del Software Corso di Laurea in Informatica per il Management. Design Patterns part 1

Design Patterns. An introduction

Agile Architecture. The Why, the What and the How

CS342: Software Design. November 21, 2017

Design Patterns. SE3A04 Tutorial. Jason Jaskolka

be used for more than one use case (for instance, for use cases Create User and Delete User, one can have one UserController, instead of two separate

A Rapid Overview of UML

INSTITUTE OF AERONAUTICAL ENGINEERING

Plan. Design principles: laughing in the face of change. What kind of change? What are we trying to achieve?

What is Design Patterns?

A Case Study of Gang of Four (GoF) Patterns: Part 3

Idioms and Design Patterns. Martin Skogevall IDE, Mälardalen University

Composite Pattern. IV.4 Structural Pattern

design patterns FOR B.tech (jntu - hyderabad & kakinada) (IV/I - CSE AND IV/II - IT) CONTENTS 1.1 INTRODUCTION TO DESIGN PATTERNS TTERNS... TTERN?...

Applying the Factory Method Design Pattern

administrivia today UML start design patterns Tuesday, September 28, 2010

Applying Design Patterns to accelerate development of reusable, configurable and portable UVCs. Accellera Systems Initiative 1

Lectures 24 and 25 Introduction to Architectural Styles and Design Patterns

Design Patterns. Dr. Rania Khairy. Software Engineering and Development Tool

UP Requirements. Software Design - Dr Eitan Hadar (c) Activities of greater emphasis in this book. UP Workflows. Business Modeling.

Template Method. Kenneth M. Anderson University of Colorado, Boulder CSCI 4448/6448 Lecture 24 11/15/2007. University of Colorado, 2007

COPYRIGHTED MATERIAL. Table of Contents. Foreword... xv. About This Book... xvii. About The Authors... xxiii. Guide To The Reader...

C++ for System Developers with Design Pattern

Interface. Design Patterns 2. Why use Interface? Design Principles. Adapter 11/7/2011. Michael Li

Extensibility Design Patterns From The Initial Stage of Application Life-Cycle

Improve Your SystemVerilog OOP Skills

DESIGNING, CODING, AND DOCUMENTING

Ownership in Design Patterns. Master's Thesis Final Presentation Stefan Nägeli

LECTURE NOTES ON DESIGN PATTERNS MCA III YEAR, V SEMESTER (JNTUA-R09)

A Primer on Design Patterns

MVC. Model-View-Controller. Design Patterns. Certain programs reuse the same basic structure or set of ideas

Nat. Thomas Software Engineering Telephonics Inc. Long Island IEEE Lecture Series

Design Patterns. "Gang of Four"* Design Patterns. "Gang of Four" Design Patterns. Design Pattern. CS 247: Software Engineering Principles

Patterns. Erich Gamma Richard Helm Ralph Johnson John Vlissides

CS 247: Software Engineering Principles. Design Patterns

Designing and Writing a Program. Divide and Conquer! The Design-Code-Debug Cycle. Documentation is Code. Pair Programming 3/8/2012

Keywords: Abstract Factory, Singleton, Factory Method, Prototype, Builder, Composite, Flyweight, Decorator.

Object Oriented Paradigm

Produced by. Design Patterns. MSc in Communications Software. Eamonn de Leastar

Design Patterns. Hausi A. Müller University of Victoria. Software Architecture Course Spring 2000

Topics. Software Process. Agile. Requirements. Basic Design. Modular Design. Design Patterns. Testing. Quality. Refactoring.

Design Patterns. Comp2110 Software Design. Department of Computer Science Australian National University. Second Semester

Software Design Patterns. Background 1. Background 2. Jonathan I. Maletic, Ph.D.

Design Patterns: Composite, Memento, Template Method, Decorator, Chain of Responsibility, Interpreter

Transcription:

Intro to Design Patterns Welcome to Design Patterns: Someone has already solved your problems The SimUDuck app p. 2 Joe thinks about inheritance... p. 5 How about an interface? p. 6 The one constant in software development p. 8 Separating what changes from what stays the same p. 10 Designing the Duck Behaviors p. 11 Testing the Duck code p. 18 Setting behavior dynamically p. 20 The Big Picture on encapsulated behaviors p. 22 HAS-A can be better than IS-A p. 23 The Strategy Pattern p. 24 The power of a shared pattern vocabulary p. 28 How do I use Design Patterns? p. 29 Tools for your Design Toolbox p. 32 Exercise Solutions p. 34 The Observer Pattern Keeping your Objects in the Know: Don't miss out when something interesting happens! The Weather Monitoring application p. 39 Meet the Observer Pattern p. 44 Publishers + Subscribers = Observer Pattern p. 45 Five minute drama: a subject for observation p. 48 The Observer Pattern defined p. 51 The power of Loose Coupling p. 53 Designing the Weather Station p. 56 Implementing the Weather Station p. 57 Using Java's built-in Observer Pattern p. 64 The dark side of java.util. Observable p. 71 Tools for your Design Toolbox p. 74 Exercise Solutions p. 78 The Decorator Pattern Decorating Objects: Just call this chapter "Design Eye for the Inheritance Guy." Welcome to Starbuzz Coffee p. 80 The Open-Closed Principle p. 86 Meet the Decorator Pattern p. 88 Constructing a Drink Order with Decorators p. 89 The Decorator Pattern Defined p. 91 Decorating our Beverages p. 92 Writing the Starbuzz code p. 95 Real World Decorators: Java I/O p. 100

Writing your own Java I/O Decorator p. 102 Tools for your Design Toolbox p. 105 Exercise Solutions p. 106 The Factory Pattern Baking with OO Goodness: Get ready to cook some loosely coupled OO designs When you see "new", think "concrete" p. 110 Objectville Pizza p. 112 Encapsulating object creation p. 114 Building a simple pizza factory p. 115 The Simple Factory defined p. 117 A Framework for the pizza store p. 120 Allowing the subclasses to decide p. 121 Let's make a PizzaStore p. 123 Declaring a factory method p. 125 Meet the Factory Method Pattern p. 131 Parallel class hierarchies p. 132 Factory Method Pattern defined p. 134 A very dependent PizzaStore p. 137 Looking at object dependencies p. 138 The Dependency Inversion Principle p. 139 Meanwhile, back at the PizzaStore... p. 144 Families of ingredients... p. 145 Building our ingredient factories p. 146 Looking at the Abstract Factory p. 153 Behind the scenes p. 154 Abstract Factory Pattern defined p. 156 Factory Method and Abstract Factory compared p. 160 Tools for your Design Toolbox p. 162 Exercise Solutions p. 164 The Singleton Pattern One of a Kind Objects: The Singleton Pattern: your ticket to creating one-of-a-kind objects, for which there is only one instance One and only one object p. 170 The Little Singleton p. 171 Dissecting the classic Singleton Pattern p. 173 Confessions of a Singleton p. 174 The Chocolate Factory p. 175 Singleton Pattern defined p. 177 Hershey, PA, we have a problem... p. 178 BE the JVM p. 179 Dealing with multithreading p. 180 Singleton Q&A; p. 184

Tools for your Design Toolbox p. 186 Exercise Solutions p. 188 The Command Pattern Encapsulating Invocation: In this chapter we take encapsulation to a whole new level: we're going to encapsulate method invocation Home Automation or Bust p. 192 The Remote Control p. 193 Taking a look at the vendor classes p. 194 Meanwhile, back at the Diner... p. 197 Let's study the Diner interaction p. 198 The Objectville Diner Roles and Responsibilities p. 199 From the Diner to the Command Pattern p. 201 Our first command object p. 203 The Command Pattern defined p. 206 The Command Pattern and the Remote Control p. 208 Implementing the Remote Control p. 210 Putting the Remote Control through its paces p. 212 Time to write that documentation p. 215 Using state to implement Undo p. 220 Every remote needs a Party Mode! p. 224 Using a Macro Command p. 225 More uses of the Command Pattern: Queuing requests p. 228 More uses of the Command Pattern: Logging requests p. 229 Tools for your Design Toolbox p. 230 Exercise Solutions p. 232 The Adapter and Facade Patterns Being Adaptive: In this chapter we're going to attempt such impossible feats as putting a square peg in a round hole Adapters all around us p. 236 Object Oriented Adapters p. 237 The Adapter Pattern explained p. 241 Adapter Pattern defined p. 243 Object and Class Adapters p. 244 Tonight's talk: The Object Adapter and Class Adapter p. 247 Real World Adapters p. 248 Adapting an Enumeration to an Iterator p. 249 Tonight's talk: The Decorator Pattern and the Adapter Pattern p. 252 Home Sweet Home Theater p. 255 Lights, Camera, Facade! p. 258 Constructing your Home Theater Facade p. 261 Facade Pattern defined p. 264 The Principle of Least Knowledge p. 265

Tools for your Design Toolbox p. 270 Exercise Solutions p. 272 The Template Method Pattern Encapsulating Algorithms: We've encapsulated object creation, method invocation, complex interfaces, ducks, pizzas...what could be next? Whipping up some coffee and tea classes p. 277 Abstracting Coffee and Tea p. 280 Taking the design further p. 281 Abstracting preparerecipe() p. 282 What have we done? p. 285 Meet the Template Method p. 286 Let's make some tea p. 287 What did the Template Method get us? p. 288 Template Method Pattern defined p. 289 Code up close p. 290 Hooked on Template Method... p. 292 Using the hook p. 293 Coffee? Tea? Nah, let's run the TestDrive p. 294 The Hollywood Principle p. 296 The Hollywood Principle and the Template Method p. 297 Template Methods in the Wild p. 299 Sorting with Template Method p. 300 We've got some ducks to sort p. 301 Comparing ducks and ducks p. 302 The making of the sorting duck machine p. 304 Swingin' with Frames p. 306 Applets p. 307 Tonight's talk: Template Method and Strategy p. 308 Tools for your Design Toolbox p. 311 Exercise Solutions p. 312 The Iterator and Composite Patterns Well-Managed Collections: There are lots of ways to stuff objects into a collection Objectville Diner and Pancake House merge p. 316 Comparing Menu implementations p. 318 Can we encapsulate the iteration? p. 323 Meet the Iterator Pattern p. 325 Adding an Iterator to DinerMenu p. 326 Looking at the design p. 331 Cleaning things up with java.util.iterator p. 333 What does this get us? p. 335 Iterator Pattern defined p. 336

Single Responsibility p. 339 Iterators and Collections p. 348 Iterators and Collections in Java 5 p. 349 Just when we thought it was safe... p. 353 The Composite Pattern defined p. 356 Designing Menus with Composite p. 359 Implementing the Composite Menu p. 362 Flashback to Iterator p. 368 The Null Iterator p. 372 The magic of Iterator & Composite together... p. 374 Tools for your Design Toolbox p. 380 Exercise Solutions p. 381 The State Pattern The State of Things: A little known fact: the Strategy and State Patterns were twins separated at birth How do we implement state? p. 387 State Machines 101 p. 388 A first attempt at a state machine p. 390 You knew it was coming...a change request! p. 394 The messy STATE of things... p. 396 Defining the State interfaces and classes p. 399 Implementing our State Classes p. 401 Reworking the Gumball Machine p. 402 The State Pattern defined p. 410 State versus Strategy p. 411 State sanity check p. 417 We almost forgot! p. 420 Tools for your Design Toolbox p. 423 Exercise Solutions p. 424 The Proxy Pattern Controlling Object Access: Every play good cop, bad cop? Monitoring the gumball machines p. 430 The role of the 'remote proxy' p. 434 RMI detour p. 437 GumballMachine remote proxy p. 450 Remote proxy behind the scenes p. 458 The Proxy Pattern defined p. 460 Get Ready for virtual proxy p. 462 Designing the CD cover virtual proxy p. 464 Virtual proxy behind the scenes p. 470 Using the Java API's proxy p. 474 Five minute drama: protecting subjects p. 478

Creating a dynamic proxy p. 479 The Proxy Zoo p. 488 Tools for your Design Toolbox p. 491 Exercise Solutions p. 492 Compound Patterns Patterns of Patterns: Who would have ever guessed that Patterns could work together? Compound Patterns p. 500 Duck reunion p. 501 Adding an adapter p. 504 Adding a decorator p. 506 Adding a factory p. 508 Adding a composite, and iterator p. 513 Adding an observer p. 516 Patterns summary p. 523 A duck's eye view: the class diagram p. 524 Model-View-Controller, the song p. 526 Design Patterns are your key to the MVC p. 528 Looking at MVC through patterns-colored glasses p. 532 Using MVC to control the beat... p. 534 The Model p. 537 The View p. 539 The Controller p. 542 Exploring strategy p. 545 Adapting the model p. 546 Now we're ready for a HeartController p. 547 MVC and the Web p. 549 Design Patterns and Model 2 p. 557 Tools for your Design Toolbox p. 560 Exercise Solutions p. 561 Better Living with Patterns Patterns in the Real World: Ahhhh, now you're ready for a bright new world filled with Design Patterns Your Objectville guide p. 578 Design Pattern defined p. 579 Looking more closely at the Design Pattern definition p. 581 May the force be with you p. 582 Pattern catalogs p. 583 How to create patterns p. 586 So you wanna be a Design Patterns writer? p. 587 Organizing Design Patterns p. 589 Thinking in patterns p. 594

Your mind on patterns p. 597 Don't forget the power of the shared vocabulary p. 599 Top five ways to share your vocabulary p. 600 Cruisin' Objectville with the Gang of Four p. 601 Your journey has just begun... p. 602 Other Design Pattern resources p. 603 The Patterns Zoo p. 604 Annihilating evil with Anti-Patterns p. 606 Tools for your Design Toolbox p. 608 Leaving Objectville... p. 609 Appendix: Leftover Patterns: Not everyone can be the most popular Bridge p. 612 Builder p. 614 Chain of Responsibility p. 616 Flyweight p. 618 Interpreter p. 620 Mediator p. 622 Memento p. 624 Prototype p. 626 Visitor p. 628 Index p. 631 Table of Contents provided by Blackwell's Book Services and R.R. Bowker. Used with permission.