Mediator Pattern

The essence of the Mediator Pattern is

to "Define an object that encapsulates how a set of objects interact". Mediator promotes loose coupling by keeping objects from referring to each other explicitly, and it lets you vary their interaction independently.

Mediator Pattern ensures

  • Loose-coupling
  • Componentizing
  • Asynchronization

What is loose-coupling?

Loose-coupling

refers to the degree of direct knowledge that one class has of another. This is not meant to be interpreted as encapsulation vs. non-encapsulation. It is not a reference to one class's knowledge of another class's attributes or implementation, but rather knowledge of that other class itself.

Component-based Architecture

Asynchronization

A mediator example

Advantages:

  • One-to-many relationship instead of many-to-many
  • Pinpointed and easy component management
  • Easy to use minimal decoupled components

Demo

thanks

@hwclass

Made with Slides.com