Skip to content

KishorNaik/Sol_Mediator_Pattern_Typescript

Repository files navigation

Mediator Design Pattern

Overview

The Mediator pattern is a behavioral design pattern that promotes loose coupling by preventing objects from referring to each other explicitly. Instead, they communicate through a mediator object. This pattern centralizes complex communication logic among objects, making the system more maintainable and flexible.

Use Cases

  • The Mediator pattern is particularly useful in scenarios where:

  • Multiple objects communicate with each other, leading to a complex network of interactions.

  • You want to centralize control logic that affects multiple objects.

  • Reducing the dependencies between objects is necessary to enhance modularity and maintainability.

Components

  • Mediator Interface: Defines methods for communication between colleague objects.

  • Concrete Mediator: Implements the Mediator interface and coordinates communication between colleague objects.

  • Colleague Objects: Objects that communicate with each other through the mediator.

Advantages

  • Decoupling: Reduces the dependencies between communicating objects, making the system easier to maintain and extend.

  • Centralized Control: Centralizes complex communication logic in a single place, simplifying the behavior of the colleague objects.

  • Enhanced Readability: Improves code readability by reducing the clutter of inter-object communication.

About

demo of Mediator Pattern in Typescript

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published