“A labor of love” (Multicast Pattern) Chapter 4 (pages 112-131 or 123-144) Chris Gordon.

Slides:



Advertisements
Similar presentations
Object-Oriented Programming Basics Prof. Ankur Teredesai, Computer Science Department, RIT.
Advertisements

CS 350 – Software Design The Bridge Pattern – Chapter 10 Most powerful pattern so far. Gang of Four Definition: Decouple an abstraction from its implementation.
©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 12Slide 1 Software Design l Objectives To explain how a software design may be represented.
CHAPTER 1 SOFTWARE DEVELOPMENT. 2 Goals of software development Aspects of software quality Development life cycle models Basic concepts of algorithm.
Matt Klein. Decorator Pattern  Intent  Attach Additional responsibilities to an object by dynamically. Decorators provide a flexible alternative to.
The Bridge Pattern.. Intent Decouple an abstraction from its implementation so that the two can vary independently Also known as: Handle/Body.
Prototype Pattern Creational Pattern Specify the kinds of objects to create using a prototypical instance, and create new objects by copy this prototype.
BehavioralCmpE196G1 Behavioral Patterns Chain of Responsibility (requests through a chain of candidates) Command (encapsulates a request) Interpreter (grammar.
Lecturer: Dr. AJ Bieszczad Chapter 66-1 Object-Oriented analysis and design Special nature of OO development Use cases Design with UML OO system design.
Software Engineering I Object-Oriented Design Software Design Refinement Using Design Patterns Instructor: Dr. Hany H. Ammar Dept. of Computer Science.
Design Pattern – Bridge (Structural) References Yih-shoung Chen, Department of Information Engineering, Feng Chia University,Taiwan, R.O.C. The Bridge.
Use Case Analysis – continued
Prototype Creational Design Pattern By Brian Cavanaugh September 22, 2003 Software, Design and Documentation.
Chapter 22 Object-Oriented Design
Design Patterns Ref : Chapter 15 Bennett et al. useful groups of collaborating classes that provide a solution to commonly occuring problems. provide.
Creational Patterns Making Objects The Smart Way Brent Ramerth Abstract Factory, Builder.
Design Patterns Discussion of pages: xi-11 Sections: Preface, Forward, Chapter
Why Analysis Process Refer to earlier chapters Models what the system will do makes it easier for understanding no environment considered (hence, system.
Design Patterns.
A Behavior Object Pattern
Software Design Refinement Using Design Patterns Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical Engineering, WVU.
05 - Patterns Intro.CSC4071 Design Patterns Designing good and reusable OO software is hard. –Mix of specific + general –Impossible to get it right the.
CS 350 – Software Design An Introduction to Design Patterns – Chapter 5 A proposition behind design patterns is that quality of software systems can be.
CSCI-383 Object-Oriented Programming & Design Lecture 13.
CSC 395 – Software Engineering Lecture 13: Object-Oriented Analysis –or– Let the Pain Begin (At Least I’m Honest!)
Patterns and Reuse. Patterns Reuse of Analysis and Design.
Chapter 2 Introducing Interfaces Summary prepared by Kirk Scott.
Strategy Design Patterns CS 590L - Sushil Puradkar.
The Factory Patterns SE-2811 Dr. Mark L. Hornick 1.
Unit 4 Object-Oriented Design Patterns NameStudent Number CAI XIANGHT082182A KYAW THU LINHT082238Y LI PENGFEIHT082220L NAUNG NAUNG LATTHT082195L PLATHOTTAM.
ECE450 - Software Engineering II1 ECE450 – Software Engineering II Today: Design Patterns VIII Chain of Responsibility, Strategy, State.
Factory Method Explained. Intent  Define an interface for creating an object, but let subclasses decide which class to instantiate.  Factory Method.
Chapter 18 The Observer Pattern Ku-Yaw Chang Assistant Professor, Department of Computer Science and Information Engineering Da-Yeh.
Proxy, Observer, Symbolic Links Rebecca Chernoff.
Behavioural Design Patterns Quote du jour: ECE450S – Software Engineering II I have not failed. I've just found 10,000 ways that won't work. - Thomas Edison.
Linzhang Wang Dept. of Computer Sci&Tech, Nanjing University The Strategy Pattern.
CSE 332: Design Patterns Review: Design Pattern Structure A design pattern has a name –So when someone says “Adapter” you know what they mean –So you can.
Manali Joshi1 The Observer Design Pattern Presented By: Manali Joshi.
Billy Bennett June 22,  Intent Specify the kinds of objects to create using a prototypical instance, and create new objects by copying this prototype.
Behavioral Patterns1 Nour El Kadri SEG 3202 Software Design and Architecture Notes based on U of T Design Patterns class.
Using Software Design Patterns Bill Anderson. About me Fox developer since 1987 Fox developer since 1987 Program Director, Los Angeles Visual Foxpro Developers.
SOFTWARE DESIGN AND ARCHITECTURE LECTURE 31. Review Creational Design Patterns – Singleton Pattern – Builder Pattern.
The Strategy Design Pattern © Allan C. Milne v
The State Pattern (Behavioral) ©SoftMoore ConsultingSlide 1.
S.Ducasse Stéphane Ducasse 1 Decorator.
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.
CSIS 4850: CS Senior Project – Spring 2009 CSIS 4850: Senior Project Spring 2009 Object-Oriented Design.
Behavioural Patterns GoF pg Iterator GoF pg. 257 – 271 Memento GoF pg By: Dan Sibbernsen.
Fusion Design Overview Object Interaction Graph Visibility Graph Class Descriptions Inheritance Graphs Fusion: Design The overall goal of Design is to.
GT3 Index Services Lecture for Cluster and Grid Computing, CSCE 490/590 Fall 2004, University of Arkansas, Dr. Amy Apon.
CSE 432: Thanks for the memory leaks, Pushme-Pullyu, and Command Summary of “Thanks for the Memory Leaks” “Left-over” design forces from Type Laundering.
CS 350 – Software Design The Facade Pattern – Chapter 6 Many design patterns are catalogued in the “Gang of Four” text. I find their definitions not to.
Design Patterns Creational Patterns. Abstract the instantiation process Help make the system independent of how its objects are created, composed and.
Command Pattern. Intent encapsulate a request as an object  can parameterize clients with different requests, queue or log requests, support undoable.
Design Patterns CSCE 315 – Programming Studio Spring 2013.
Design Patterns: MORE Examples
Software Design Refinement Using Design Patterns
The Movement To Objects
Design Patterns Lecture part 2.
Instructor: Dr. Hany H. Ammar
Part 3 Design What does design mean in different fields?
object oriented Principles of software design
Factory Method, Abstract Factory, and More
CS 350 – Software Design The Facade Pattern – Chapter 6
Unified Modeling Language
Behavioral Design Pattern
Review: Design Pattern Structure
DESIGN PATTERNS : State Pattern
Strategy Design Pattern
HFOOAD Chapter 5 Interlude
Presentation transcript:

“A labor of love” (Multicast Pattern) Chapter 4 (pages or ) Chris Gordon

Multicast Pattern  Described in the book as incomplete, work in progress, half baked, etc

What is multicast?  Its for event driven programming  “The flow of control is driven by external stimuli called events”

Consider a vending machine A vending machine is just a very specific computer driven by various events

How do we code this?  It can get very complex  Which objects use the events?  The answers can change even dynamically  Soon becomes a nightmare to code/maintain

The vending machine can be represented as follows An event registry is a common solution:

Event Registry  Two interfaces  One for events  One for event handlers

Problems with event registry  Not type safe  Can leave hidden run-time errors  Bad!

What should we do?  Blame someone else?  Give up and cry?  Multicast pattern!

Details  Multiple inheritance  Each event has an abstract class  Each handler inherits from any events it can handle  Type safe!

Details (continued)  How do the events get delivered?  Still need a registry, but need it type specific...  Register becomes exactly that, multiple type specific registries  Some debate over where this goes; seems to make the most sense in the event classes

Structure  So here is our final structure:

Participants  Message Encapsulates information to be transferred from Sender to Receiver Encapsulates information to be transferred from Sender to Receiver  Sender Maintains a registry of Receiver objects. Maintains a registry of Receiver objects. Defines an interface for registering Receiver objects. Defines an interface for registering Receiver objects. Defines and implements an interface for delivering a Message to registered Receiver objects. Defines and implements an interface for delivering a Message to registered Receiver objects.  AbstractReceiver Defines an interface for receiving a Message object. Defines an interface for receiving a Message object.  Receiver Implements one or more AbstractReceiver interfaces. Implements one or more AbstractReceiver interfaces.  Collaborations Clients register receivers with senders through Sender's registration interface. Clients register receivers with senders through Sender's registration interface. Senders instantiate messages and deliver them to registered receivers. Senders instantiate messages and deliver them to registered receivers.

Applicability  Objects want to receive info from other objects  Information is complex (it varies)  You want type safety (who doesn’t?)

The big question  Is it really a type?  Seems to be just a special case of Observer  Should these details just be included in that pattern Lots of questions involved in this issue Lots of questions involved in this issue Is every observer really a multicast? Is every observer really a multicast? There are reasons patterns shouldn’t get too big There are reasons patterns shouldn’t get too big Strong/weak types play into this Strong/weak types play into this

Intent  Very similar to observer  In observer the concrete observers vary  In multicast the events (messages) are the important variation  But it still sounds to similar

Surprise! There’s a new pattern  After much argument, it was decided that Multicast is a refinement of observer called “Typed Message”

Intent  Still very similar to observer  Encapsulate information in an object to add information without compromising type safety

Motivation  Same as multicast  Event driven scenarios

Participants (same)  Message (ProductDispensedEvent) Encapsulates information to be transferred from Sender to Receiver. Encapsulates information to be transferred from Sender to Receiver.  Sender (Dispenser) Maintains a reference to a Receiver object. Maintains a reference to a Receiver object. Implements one or more operations that involve sending a message to the receiver. Implements one or more operations that involve sending a message to the receiver.  AbstractReceiver (ProductDispensedHandler) Defines an interface for receiving a Message object. Defines an interface for receiving a Message object.  Receiver (CoinChanger) Implements one or more AbstractReceiver interfaces. Implements one or more AbstractReceiver interfaces.  Collaborations A sender instantiates a message and delivers it to its receiver. A sender instantiates a message and delivers it to its receiver. A message is passive; it does not initiate communication with senders or receivers. A message is passive; it does not initiate communication with senders or receivers.

Applicability  Objects want to receive info from other objects  Information is complex (it varies)  You want type safety (who doesn’t?)  Same as multicast

Consequences  Type safety  Type safety  Supports implicit invocation when combined with observer ??  Difficult without multiple inheritance   Inheritance hierarchies get cluttered   More flexible than observer  More flexible than observer