Files
java-design-patterns/mediator/index.md
T

30 lines
1000 B
Markdown
Raw Normal View History

2015-08-13 23:54:40 +02:00
---
layout: pattern
title: Mediator
folder: mediator
permalink: /patterns/mediator/
2015-08-20 21:40:07 +02:00
categories: Behavioral
tags:
- Java
- Gang Of Four
- Difficulty-Intermediate
2015-08-13 23:54:40 +02:00
---
## Intent
Define an object that encapsulates how a set of objects interact.
2015-08-13 23:54:40 +02:00
Mediator promotes loose coupling by keeping objects from referring to each
other explicitly, and it lets you vary their interaction independently.
![alt text](./etc/mediator_1.png "Mediator")
## Applicability
Use the Mediator pattern when
2015-08-13 23:54:40 +02:00
* a set of objects communicate in well-defined but complex ways. The resulting interdependencies are unstructured and difficult to understand
* reusing an object is difficult because it refers to and communicates with many other objects
* a behavior that's distributed between several classes should be customizable without a lot of subclassing
## Credits
* [Design Patterns: Elements of Reusable Object-Oriented Software](http://www.amazon.com/Design-Patterns-Elements-Reusable-Object-Oriented/dp/0201633612)