CSSE 374: More Object Design with Gang of Four Design Patterns

Similar documents
More Object Design with GoF Patterns CSSE 574: Session 7, Part 2

CSSE 374: Even More Object Design with Gang of Four Design Patterns

CSSE 374: UML Activity Diagrams. Shawn Bohner Office: Moench Room F212 Phone: (812)

CSSE 374: GRASP ing at the First Five Patterns Principles. Shawn Bohner Office: Moench Room F212 Phone: (812)

2009 Shawn A. Bohner. Shawn Bohner Office: Moench Room F212 Phone: (812)

CSSE 374: Logical Architecture. Shawn Bohner Office: Moench Room F212 Phone: (812)

Introduction to Software Engineering: Object Design I Reuse & Patterns

Applying Some Gang of Four Design Patterns CSSE 574: Session 5, Part 3

Applying Some More Gang of Four Design Patterns CSSE 574: Session 5, Part 4

2009 Shawn A. Bohner. Shawn Bohner Office: Moench Room F212 Phone: (812)

DESIGN PATTERN - INTERVIEW QUESTIONS

UNIT I Introduction to Design Patterns

Applying Design Patterns to SCA Implementations

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

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

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

Design Patterns. An introduction

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

SDC Design patterns GoF

Lecture 4: Observer Pattern, Event Library and Componentization

2009 Shawn A. Bohner. Shawn Bohner Office: Moench Room F212 Phone: (812)

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

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

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

Object-oriented Software Design Patterns

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

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

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

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

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

Using Design Patterns in Java Application Development

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

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

A Reconnaissance on Design Patterns

Produced by. Design Patterns. MSc in Computer Science. Eamonn de Leastar

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

DESIGN PATTERNS MOCK TEST DESIGN PATTERNS MOCK TEST II

UNIT I Introduction to Design Patterns

TDDB84. Lecture 2. fredag 6 september 13

THOMAS LATOZA SWE 621 FALL 2018 DESIGN PATTERNS

Design patterns. OOD Lecture 6

Design Patterns. SE3A04 Tutorial. Jason Jaskolka

Model-Driven Architecture/ Development

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

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

Overview of Patterns: Introduction

Lectures 24 and 25 Introduction to Architectural Styles and Design Patterns

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

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

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

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

A Rapid Overview of UML

INSTITUTE OF AERONAUTICAL ENGINEERING

We are at System Operation Contracts

CSSE 490 Model-Based Software Engineering: Software Factories

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

I, J. Key-value observing (KVO), Label component, 32 text property, 39

What is Design Patterns?

CSSE 490 Model-Based Software Engineering: Cougaar Model-Driven Architecture Example

Design Patterns: Structural and Behavioural

C++ for System Developers with Design Pattern

CS/CE 2336 Computer Science II

1 Software Architecture

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

Tuesday, October 4. Announcements

CSSE 374: Design Class Diagrams. Shawn Bohner Office: Moench Room F212 Phone: (812)

Application Architectures, Design Patterns

Material and some slide content from: - GoF Design Patterns Book. Design Patterns #1. Reid Holmes. Lecture 11 - Tuesday October

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

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

Object-Oriented Oriented Programming

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

Design patterns. Jef De Smedt Beta VZW

Logical Architecture & Design Preliminaries

The Design Patterns Matrix From Analysis to Implementation

SWEN425 DESIGN PATTERNS

Lecture 20: Design Patterns II

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

Pro Objective-C Design Patterns for ios

Design Patterns. CSE870: Advanced Software Engineering (Design Patterns): Cheng

Design Patterns! Acknowledgements!

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

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

Applying the Observer Design Pattern

Think of drawing/diagramming editors. ECE450 Software Engineering II. The problem. The Composite pattern

PATTERN-ORIENTED SOFTWARE ARCHITECTURE

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

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

More Object Design with GoF Patterns (continued) CSSE 574: Session 7, Part 3

192. Design Patterns in Java Software

Review Software Engineering October, 7, Adrian Iftene

Overview CS Kinds of Patterns. Design Pattern. Factory Pattern Rationale. Kinds of Factory Patterns

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

CSSE 490 Model-Based Software Engineering: Domain Engineering

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

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

A few important patterns and their connections

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

APPLYING DESIGN PATTERNS TO SCA IMPLEMENTATIONS

R07. IV B.Tech. II Semester Supplementary Examinations, July, 2011

Transcription:

CSSE 374: More Object Design with Gang of Four Design Patterns Shawn Bohner Office: Moench Room F212 Phone: (812) 877-8685 Email: bohner@rose-hulman.edu Q1

Learning Outcomes: Patterns, Tradeoffs Identify criteria for the design of a software system and select patterns, create frameworks, and partition software to satisfy the inherent trade-offs. Using GoF Patterns in Iteration 3 Local caching Failover to local services Support for third-party POS devices Handling payments Exercise (if time) Design Studio with Team 2.3 Q3

Gang of Four Design Patterns Behavioral Interpreter Template Method Chain of Responsibility Command Iterator Mediator Memento Observer State Strategy Visitor Creational Factory Abstract Factory Builder Prototype Singleton Structural Adapter Bridge Composite Decorator Façade Flyweight Proxy Q1

Failover & Performance with Local Caching What is a cache? How does a cache usually work? Why use a local cache for NextGen POS? Performance Improve recoverability Q2

Search Strategy for Product Information 1. Look in memory (in map stored by ProductCatalog) 2. Look on local hard drive cache 3. Retrieve from remote persistence service Q3

Applying the Adapter Pattern True Adapters Q4

Using a Factory to Set Up for Local Caching create :Store 2: create(pc) :Register 1: create the local service is returned Eliminate local cache? pc: ProductCatalog 1.1: psa = getproductsadapter() :ServicesFactory 1 1.1.2: create( externalservice ) 1.1.1: create psa : LocalProducts externalservice : DBProductsAdapter Change external data source? the local service gets a reference to the adapter for the external service Q5

Product Lookup with In-memory Miss

Product Lookup with Local Cache Miss

Using Threads to Freshen the Cache Async msg

How s the final iteration going? Used by permission. http://notinventedhe.re/on/2009-12-28

Handling Failure in NextGen POS: What should happen if there is a local cache miss and the external product information service fails? Think for 15 seconds Turn to a neighbor and discuss it for a minute

DCD: Exceptions Caught and Thrown usagestatistics : Map PersistenceFacade Object get(key, Class) throws DBUnavailableException, FatalException put(key, Object) { exceptions= (DBUnavailableException, FatalException) }... FatalException DBUnavailableException exceptions

Showing Exception in Sequence Diagrams ps = getdescription(id) : DBProducts Adapter : Persistence Facade : java.sql.statement note the difference between synchronous and asynchronous message arrowheads in the UML «exception» ProductInfoUnavailableException() ps = get(...) «exception» DBUnavailableException() resultset = executequery(...) «exception» SQLException() Name the Problem not the Thrower Convert Exceptions pattern Q6

How should NextGen POS handle this exception? Common exception handling patterns Use a central error logging object to record all exceptions for diagnosis by developers Use a standard, application-independent, non- UI object to notify users Can delegate to multiple different UI notifications Protected Variation for changes in reporting Q7

Failover to Local Services with a Proxy

Proxy GoF Pattern Problem: How do we control access to some subject object if we want to avoid giving direct access? Solution: Add a level of indirection with a proxy object that implements the same methods as the subject and conditionally delegates to it. Q8,9

Structure of the Proxy Pattern Client subject : ISubjectInterface dobar() 1 1 foo() «interface» ISubjectInterface {... whatever subject.foo()... whatever } subject actually references an instance of Proxy, not RealSubject {... pre-processing realsubject.foo()... post-processing } Proxy realsubject : ISubjectInterface foo() "realsubject" will actually reference an instance of RealSubject foo() RealSubject

Proxy in NextGen POS Posting sales to the accounting service Send postsale(sale) to a redirection proxy Proxy attempts to post to external service If it fails, then proxy stores result locally

Proxy in NextGen POS DCD

Proxy in NextGen POS: Object Diagram

Exercise: Proxy for Failover Break up into your teams Consider how NextGen POS can use a Proxy to failover to local storage if the remote accounting service is down. Sketch a communication diagram depicting the above situation.

Design Studio Calendar Monday Tuesday Thursday 8th week Team 2.4 Team 2.1 9th week Team 2.2 Today Team 2.3 Team 2.5 10th week Team 2.4 Team 2.1 Course Wrap-up

Homework and Milestone Reminders Read Chapter 37 Milestone 5 Final Junior Project System and Design Preliminary Design Walkthrough on Friday, February 11th, 2011 during weekly project meeting Final due by 11:59pm on Friday, February 18 th, 2011 Team 2.5 Design Studio