Mediator Design Pattern
(Behavioral)
-Mr.Anuj B. Pawar.
Roll No. 51
Intent
Mediator Pattern _ap2
 Object Behavioral an object that encapsulates how a
set of objects, which can interact and refer each other
independently.
Motivation
Mediator Pattern _ap3
 Requirement of system –
 A system needs objects to communicate with each other and
should be able to share properties of each other.
 Desired system will have –
 Different objects which can communicate with each other.
 Problem –
 Object structure will have many connections between objects
 Every object ends up knowing about every other.
Applicability
Mediator Pattern _ap4
 When one or more objects must interact with several different
objects.
 When simple object need to communicate in complex ways.
 When you want to reuse an object that frequently interacts with
other objects.
Example- Problem
Mediator Pattern _ap5
Example-Solution
03/04/03CS590L Mediator Pattern6
Example-Steps
Mediator Pattern _ap7
 The list box tells its director that it’s changed.
 The director gets the selection from the list box.
 The director passes the selection to the entry field.
 Director takes action.
General Structure
Mediator Pattern _ap8
Participants
Mediator Pattern _ap9
 Mediator
-defines an interface for communicating with Colleague
objects.
 Concrete Mediator
-implements cooperative behavior by coordinating
Colleague objects.
-knows and maintains its colleagues.
 Colleague classes
-each Colleague class knows its Mediator object.
-each colleague communicates with its mediator
whenever it would have otherwise communicated with
another colleague.
Related Patterns
Mediator Pattern _ap10
 Façade
 Observer
Mediator Pattern _ap11
Thank You..

Mediator Pattern