 How are you going to collaborate?  How are you going to divide up work?  How are you going to make sure that changes work with other people’s code?

Slides:



Advertisements
Similar presentations
GoF State Pattern Aaron Jacobs State(305) Allow an object to alter its behavior when its internal state changes. The object will appear to change its class.
Advertisements

Winter 2007ACS-3913 Ron McFadyen1 Duck Example Consider the text example (up to page 6). Each type of duck is a subclass of Duck Most subclasses implement.
Design Patterns Copyright © Vyacheslav Mukhortov, Nikita Nyanchuk-Tatarskiy, Copyright © INTEKS LLC,
SWE 4743 Strategy Patterns Richard Gesick. CSE Strategy Pattern the strategy pattern (also known as the policy pattern) is a software design.
Matt Klein 7/6/2009.  Behavioral Pattern  Intent  Allow an object to alter its behavior when its internal state changes. The object will appear to.
Plab – Tirgul 12 Design Patterns
Fall 2009ACS-3913 Ron McFadyen Composite Pattern Problem: How do we treat a composition structure of objects the same way as a non-composite object? Arises.
Design Patterns Based on Design Patterns. Elements of Reusable Object-Oriented Software. by E.Gamma, R. Helm, R. Johnson,J. Vlissides.
Design Patterns Module Name - Object Oriented Modeling By Archana Munnangi S R Kumar Utkarsh Batwal ( ) ( ) ( )
ECE 355 Design Patterns Tutorial Part 2 (based on slides by Ali Razavi) Presented by Igor Ivković
Spring 2010ACS-3913 Ron McFadyen1 Duck Example Consider the text example (up to page 6). Each type of duck is a subclass of Duck Most subclasses implement.
PRESENTED BY SANGEETA MEHTA EECS810 UNIVERSITY OF KANSAS OCTOBER 2008 Design Patterns.
ECE450 - Software Engineering II1 ECE450 – Software Engineering II Today: Design Patterns VI Composite, Iterator, and Visitor Patterns.
Design Patterns academy.zariba.com 1. Lecture Content 1.What are Design Patterns? 2.Creational 3.Structural 4.Behavioral 5.Architectural 6.Design Patterns.
1 An introduction to design patterns Based on material produced by John Vlissides and Douglas C. Schmidt.
Design Patterns Discussion of pages: xi-11 Sections: Preface, Forward, Chapter
BDP Behavioral Pattern. BDP-2 Behavioral Patters Concerned with algorithms & assignment of responsibilities Patterns of Communication between Objects.
Design Patterns.
Chapter 1: Introduction to Design Patterns. SimUDuck Example.
05 - Patterns Intro.CSC4071 Design Patterns Designing good and reusable OO software is hard. –Mix of specific + general –Impossible to get it right the.
Case Studies on Design Patterns Design Refinements Examples.
Design Pattern. The Observer Pattern The Observer Pattern defines a one-to-many dependency between objects so that when one object changes state, all.
Y2 eProjects Session 4 – Advanced Topics. Objectives  Dynamic Models  Design Patterns (Optional)  Software testing (for S4) ACCP i7.1\Sem3_4\eProject\T4.
Strategy Design Patterns CS 590L - Sushil Puradkar.
18 April 2005CSci 210 Spring Design Patterns 1 CSci 210.
CS 210 Adapter Pattern October 19 th, Adapters in real life Page 236 – Head First Design Patterns.
GoF: Document Editor Example Rebecca Miller-Webster.
Design Patterns CS 124 Reference: Gamma et al (“Gang-of-4”), Design Patterns.
ECE450S – Software Engineering II
Patterns in programming1. 2 What are patterns? Answers to common design problems. A language used by developers –To discuss answers to design problems.
Design Patterns CSIS 3701: Advanced Object Oriented Programming.
ECE450 - Software Engineering II1 ECE450 – Software Engineering II Today: Design Patterns VIII Chain of Responsibility, Strategy, State.
Design Patterns Yonglei Tao. Design Patterns  A design pattern describes a recurring design problem, a solution, and the context in which that solution.
OO Methodology Elaboration Iteration 2 - Design Patterns -
DESIGN PATTERNS COMMONLY USED PATTERNS What is a design pattern ? Defining certain rules to tackle a particular kind of problem in software development.
Behavioral Patterns CSE301 University of Sunderland Harry R Erwin, PhD.
CS 210 Final Review November 28, CS 210 Adapter Pattern.
Design Patterns Introduction
Advanced Object-oriented Design Patterns Creational Design Patterns.
Example to motivate discussion We have two lists (of menu items) one implemented using ArrayList and another using Arrays. How does one work with these.
Proxy Pattern defined The Proxy Pattern provides a surrogate or placeholder for another object to control access to it by creating a representative object.
Watching the movie the hard way…. Page 256 – Head First Design Patterns.
CS 210 Proxy Pattern Nov 16 th, RMI – A quick review A simple, easy to understand tutorial is located here:
CSE 332: Design Patterns (Part II) Last Time: Part I, Familiar Design Patterns We’ve looked at patterns related to course material –Singleton: share a.
StarBuzz Coffee Recipe Boil some water Brew coffee in boiling water Pour coffee in cup Add sugar and milk Tea Recipe Boil some water Steep tea in boiling.
Five Minute Design Patterns Doug Marttila Forest and the Trees May 30, 2009 Template Factory Singleton Iterator Adapter Façade Observer Command Strategy.
An object's behavior depends on its current state. Operations have large, multipart conditional statements that depend on the object's state.
Design Patterns Creational Patterns. Abstract the instantiation process Help make the system independent of how its objects are created, composed and.
Design Patterns CSCE 315 – Programming Studio Spring 2013.
Examples (D. Schmidt et al)
Design Patterns: MORE Examples
Strategy: A Behavioral Design Pattern
Design Patterns: Brief Examples
Strategy Design Pattern
Strategy Pattern Jim Fawcett CSE776 – Design Patterns Fall 2014.
Chapter 10 Design Patterns.
Common Design Patterns
Design Patterns Lecture part 2.
Factory Patterns 1.
Behavioral Design Patterns
object oriented Principles of software design
Presented by Igor Ivković
State Design Pattern 1.
Object Oriented Design Patterns - Creational Patterns
State-Transition Diagrams
Strategy Design Pattern
Informatics 122 Software Design II
Presented by Igor Ivković
State-Transition Diagrams
Strategy Pattern Jim Fawcett CSE776 – Design Patterns Fall 2014.
Presentation transcript:

 How are you going to collaborate?  How are you going to divide up work?  How are you going to make sure that changes work with other people’s code?  What’s needed to write Pong?

 Useful abstractions for commonly used design structure  Patterns and their consequences of use have been thought through by experienced designers  Helpful for good OO design  Describe what to do and what not to do when implementing the patterns in your project

 Encapulate the things that vary from object to object as separate classes  But keep common code together  Example in HFDP book: Ducks

 In AI, we talk about “agents”  In graphics, we talk about (rendering) “entities”  Example:  Reflex agent  Reflex agent with state  Goal-directed agent  Entities vs. strategies vs. state

 Composite: Compose objects into tree structures to represent part-whole hierarchies, let clients treat individual objects and compositions of objects uniformly.  Strategy: Defines a family of algorithms, encapsulates each one and makes them inter-changeable. Strategy lets the algorithm vary independently from clients that use it.  State: Allow an object to alter its behavior when its internal state changes. The object will appear to change its class.  Singleton: ensure a class has only one instance, and provide a global access point to it

 Abstract Factory: create concrete instances of abstract interfaces  Visitor: perform an operation on an object (i.e. all elements of the scene graph) without altering the object  FrameListener: hook in to receive notices of events from an announcing object  Singleton: enforce one instance  Façade: create a convenient access point for many operations on diverse classes

 One pointer to a state instance with subclasses  The state object knows under what conditions it should change to a different active state  described in Ch2 of PGAIBE, good walkthrough in HeadFirst design patterns  Eliminates the need for giant if statements  Easier to extend with new substate classes

 Represent a process specification  Have 4 components  States  Transitions  Conditions  Actions  Must have one initial state  May have multiple final states

Idle Playing Messages Rewinding Recording Message Waiting for call Answering Call

 A condition is an event in the external environment which triggers a transition to a new state  An action is a response sent back to the external environment or a calculation whose result is stored by the system that occurs when the transition takes place

Idle Waiting for Call Answering Call Press Answer button Ready to receive light goes on Action Condition Incoming call detected Condition End of Call or tape runs out Press Cancel button Ready to receive button goes out Condition Action

State 2 Can be partitioned to State 2.1State 2.2 State 2.4 State 2.3

 Have all states been defined?  Can you reach all the states?  Can you exit from all the states?  In each state does the system respond to all possible conditions?

 How do FSMs (state transition diagrams) relate back to the idea of agents?  How would you implement state using design patterns?