Design Patterns

Last updated Mar 5, 2002


Mediator

กก

Object Behavioral
Design Pattern

E. Gamma, et al., Design Pattern : Elements of Reusable Object-Oriented Software, Addison-Wesley, 1995, Chapter 5, pp. 273-282


  1. Intent
  2. Also Known As
  3. Motivation
  4. Applicability
  5. Structure
  6. Participants
  7. Collaborations
  8. Consequences
  9. Implementation
  10. Sample Code
  11. Known Uses
  12. Related Patterns

Intent

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.

Motivation

Applicability

Use the Mediator pattern when

Structure

Participants

Collaborations

Consequences

  1. It limits subclassing.
  2. It decouples colleagues.
  3. It simplifies object protocols.
  4. It abstracts how objects cooperate.
  5. It centralizes control.

Implementation

  1. Omitting the abstract Mediator class.
  2. Colleague-Mediator communication.

Sample Code

Known Uses

Related Patterns


Taewoong Jeon jeon@korea.ac.kr
Department of Computer Science, Korea University