GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — JavaScript-Design-Patterns/GoF/classic/Behavioral/Mediator at master · irynaO/JavaScript-Design-Patterns

Expand file tree

/

Mediator

/
Copy path

Directory actions

More options

More options

Directory actions

More options

More options

Latest commit

 

History

History
History
 
 
/

Mediator

/
Copy path

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
CoffeeScript
CoffeeScript
 
 
ECMAScript
ECMAScript
 
 
TypeScript
TypeScript
 
 
Mediator.dia
Mediator.dia
 
 
Mediator.png
Mediator.png
 
 
README.md
README.md
 
 

README.md

Outline

Synopsis

Tom and Dick are neighbors. Dick makes a lot of noise on Sunday mornings, which drives Tom crazy. Communication has become difficult between them because of this.

Problem

If Tom and Dick cannot talk to each other directly, Dick will continue to make noise and Tom will get angry every Sunday.

Solution

When communication is difficult between two objects or in a system (here the neighborhood), the solution is delegation to a third-party object. This object will make communication easier between all other objects.

This is exactly the solution proposed by the Mediator pattern. To implement this pattern, we need:

  • An abstract representation of a neighbor (abstract class should be preferred because it centralizes the reference to the mediator)
  • An abstract representation of a neighborhood mediator (abstract class or interface)
  • Concrete neighbors (Tom and Dick)
  • A concrete mediator (Harry)

Mediator (classic)

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.