DOC PREVIEW
SJSU CMPE 196G - More on Behavioral Patterns
Pages 25

This preview shows page 1-2-24-25 out of 25 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 25 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 25 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 25 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 25 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 25 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

PowerPoint PresentationLesson ObjectivesBehavioral PatternsMediator Pattern: DefinitionMediator Pattern: IllustrationMediator Pattern: More IllustrationMediator Pattern: StructureDialog Director ExampleDialog Director Example: Interaction DiagramMediator Pattern: Participants & CollaborationsMediator Pattern: Restaurant ExampleSlide 12Mediator Pattern: The SolutionMediator Pattern: More on The SolutionMediator Pattern: AdvantagesMediator Pattern: DisadvantagesMediator Pattern: When It Should be UsedSlide 18Observer Pattern: DefinitionObserver Pattern: StructureObserver Pattern: ApplicabilityObserver Pattern: ParticipantsObserver Pattern: Collaborations Instance DiagramObserver Pattern: Implementation IssuesDiscussion QuestionsCopyright © 1995-2004 Active Frameworks Inc. - All Rights Reserved. More On Behavioral Patterns - Page L9-1PS95&96-MEF-L16-1Dr. M.E. FayadCreationalParadigm Shift, Inc.Software FactoryBehavioralStructuralLesson 9:More On Behavioral PatternsLesson 9:More On Behavioral PatternsObject-Object-OrientedOrientedDesignDesignPatternPatternssCopyright © 1995-2004 Active Frameworks Inc. - All Rights Reserved. More On Behavioral Patterns - Page L9-2PS95&96-MEF-L16-2Dr. M.E. FayadLesson ObjectivesLesson ObjectivesObjectivesPresent the following Patterns:MediatorObserverDiscuss in detail the behavioral patternsCopyright © 1995-2004 Active Frameworks Inc. - All Rights Reserved. More On Behavioral Patterns - Page L9-3PS95&96-MEF-L16-3Dr. M.E. FayadBehavioral PatternsMediator Pattern•Topics–Mediator Definition–Structure–Graphic UI Example–Problems it Solves–Participants –Benefits–Related PatternsCopyright © 1995-2004 Active Frameworks Inc. - All Rights Reserved. More On Behavioral Patterns - Page L9-4PS95&96-MEF-L16-4Dr. M.E. FayadMediator Pattern: Definition•Mediator object coordinates communication between interacting objects.•Interacting objects work with and through a Mediator rather than each other directly.•The Mediator pattern is also known as a “glue” pattern.•The Mediator pattern decouples the individual tasks.–Each object only knows its own input and output.–This way, each object does not depend on the other objects around it.Copyright © 1995-2004 Active Frameworks Inc. - All Rights Reserved. More On Behavioral Patterns - Page L9-5PS95&96-MEF-L16-5Dr. M.E. FayadMediator Pattern: IllustrationClient or UserObject AObject CObject DObject BThe “Before” ModelCopyright © 1995-2004 Active Frameworks Inc. - All Rights Reserved. More On Behavioral Patterns - Page L9-6PS95&96-MEF-L16-6Dr. M.E. FayadMediator Pattern: More IllustrationClient or UserObject AObject CObject DObject BThe “After” ModelMediator ObjectAbstractionColleague objectsCopyright © 1995-2004 Active Frameworks Inc. - All Rights Reserved. More On Behavioral Patterns - Page L9-7PS95&96-MEF-L16-7Dr. M.E. FayadMediator Pattern: StructureMediatorcolleague classesCopyright © 1995-2004 Active Frameworks Inc. - All Rights Reserved. More On Behavioral Patterns - Page L9-8PS95&96-MEF-L16-8Dr. M.E. FayadDialog Director ExampleDialogDirectorShowDialog()CreateControls()HandleChange(Control)ControlSelect()director-> HandleChange(this)EntryFielddirectorListDialogCreateControls()HandleChange(Control)ListBox• DialogDirector is an abstract class that defines the overall infrastructure of a dialog. It keeps a reference to the window that presents the dialog. • Clients call the ShowDialog operation to display the dialog on the screen.• CreateControls and HandleChange are abstract operations.• DialogDirector subclasses override CreateControls to create the proper controls and HandleChange to handle the changes.• DialogDirector is an abstract class that defines the overall infrastructure of a dialog. It keeps a reference to the window that presents the dialog. • Clients call the ShowDialog operation to display the dialog on the screen.• CreateControls and HandleChange are abstract operations.• DialogDirector subclasses override CreateControls to create the proper controls and HandleChange to handle the changes.Copyright © 1995-2004 Active Frameworks Inc. - All Rights Reserved. More On Behavioral Patterns - Page L9-9PS95&96-MEF-L16-9Dr. M.E. FayadDialog Director Example: Interaction DiagramGetSelectionDialogDirectorColleagueClientSetTextHandleChangeListBoxShowDialogMediatorEntryFieldCopyright © 1995-2004 Active Frameworks Inc. - All Rights Reserved. More On Behavioral Patterns - Page L9-10PS95&96-MEF-L16-10Dr. M.E. FayadMediator Pattern: Participants & Collaborations•Mediator (DialogDirector)–implements cooperative behavior by coordinating Colleague objects.–stores state.•Colleague classes (ListBox, EntryField)–implements pieces of the cooperative behavior.Collaborations• Colleagues send/receive requests to/from a Mediator object.• The Mediator implements the cooperative behavior by routing requests between the appropriate Colleague(s).Collaborations• Colleagues send/receive requests to/from a Mediator object.• The Mediator implements the cooperative behavior by routing requests between the appropriate Colleague(s).ParticipantsCopyright © 1995-2004 Active Frameworks Inc. - All Rights Reserved. More On Behavioral Patterns - Page L9-11PS95&96-MEF-L16-11Dr. M.E. Fayad•It is time for breakfast. A customer places an order and gives it to the egg cooker. •The egg cooker does his job and then moves the order to the fry cook for meat and hash browns. The fry cook sends the plate on, and so forth.•When the order has finished processing in the kitchen the customer’s name is called and the plate is given to the customer.•This scheme is inflexible because you cannot change the structure of the kitchen and you cannot add any other steps to the cooking processes.Mediator Pattern: Restaurant ExampleCopyright © 1995-2004 Active Frameworks Inc. - All Rights Reserved. More On Behavioral Patterns - Page L9-12PS95&96-MEF-L16-12Dr. M.E. FayadMediator Pattern: Restaurant ExampleCustomer in a restaurantEggsToastFry2FryThe “Before” ModelCopyright © 1995-2004 Active Frameworks Inc. - All Rights Reserved. More On Behavioral Patterns - Page L9-13PS95&96-MEF-L16-13Dr. M.E. FayadMediator Pattern: The SolutionCustomer in a Restaurant EggsFry2ToastFryThe “After” ModelWaitpersonAbstractionColleague objectsCopyright © 1995-2004 Active Frameworks Inc. - All Rights Reserved. More On Behavioral Patterns - Page


View Full Document

SJSU CMPE 196G - More on Behavioral Patterns

Download More on Behavioral Patterns
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view More on Behavioral Patterns and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view More on Behavioral Patterns 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?