Over a million developers have joined DZone.

The Mediator Pattern

· Java Zone

Learn more about Kotlin, a new programming language designed to solve problems that software developers face every day brought to you in partnership with JetBrains.

Description:

It defines 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

Benefits:

  •  Decouples colleagues
  •  Simplifies object protocols
  •  Centralizes control

When to use:

  • A set of objects communicate in well-defined but complex ways.
  • You want to customize a behavior that’s distributed between several objects without using subclasses.

Diagram:

 

The Java Zone is brought to you in partnership with JetBrains.  Discover how powerful static code analysis and ergonomic design make development not only productive but also an enjoyable experience.

Topics:

Published at DZone with permission of Cristian Chiovari , DZone MVB .

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}