Mediator pattern is used to decrease communication simplicity between several objects or classes. This pattern provides a mediator class which normally handles all the communications between different classes and supports easy continuance of the code by loose coupling. Mediator pattern fall under behavioural pattern group.
We are representative intermediary pattern by instance of a chat room where many users can send message to chat room and it is the task of chat room to explain the messages to all users. We have created two classes Chartroom and User. User objects will use Chartroom method to distribute their messages.
MediatorPatternDemo, our presentation class, will use User objects to prove communication between them.
Create mediator class.
Create user class
Use the client object to explain communications between them.
Verify the output.
Design Patterns Related Interview Questions
|Java Script Interview Questions||AJAX Interview Questions|
|Graphic Design Interview Questions||Adobe Indesign Interview Questions|
|Java-Multithreading Interview Questions||Database Design Interview Questions|
|Compiler Design Interview Questions||CSS Advanced Interview Questions|
|Java Design Patterns Interview Questions||Hardware design Interview Questions|
|Material Design Lite Interview Questions||Object Oriented Analysis and Design Interview Questions|
|Standard Template Library (STL) Interview Questions|
Design Patterns Tutorial
All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.