The mediator pattern is a software design pattern that provides a unified interface to a set of interfaces in a subsystem. It's one of the 23 design patterns described by the Gang of Four. This pattern is considered to be a behavioral pattern due to the way it can alter the program's running behavior. Usually a program is made up of a (sometimes large) number of classes. So the logic and computation is distributed among these classes. However, as more classes are developed in a program, especially during maintenance and/or refactoring, the problem of communication between these classes may become more complex. This makes the program harder to read and maintain. Furthermore, it can become difficult to change the program, since any change may affect code in several other classes. The mediator pattern consists of a mediator class that is the only class that has detailed knowledge of the methods of other classes. Classes send messages to the mediator when needed and the mediator passes them on to any other classes that need to be informed. The mediator class promotes looser coupling between a number of other classes.
See also
External links
- Mediator Pattern in Java
- Mediator Pattern in C#
- Mediator pattern discussion with 1-page examples in C++ and Java
- Jt J2EE Pattern Oriented Framework
|
|
|---|
|
Creational: Abstract factory • Builder • Factory • Prototype • Singleton |


