Monday 3 July 2017

Software Engineering: Mediator Pattern

Behavioral Pattern - Mediator Pattern

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. 

Why is this used?
This increases the res-usability of objects supported by the Mediator by decoupling them from the system. In addition, this simplifies the maintenance of the system by centralising control logic. Also, this simplifies and reduces the variety of messages sent between objects in the system.


UML diagram representation


https://i.stack.imgur.com/T4KCw.png

Visual representation


http://www.jamesportis.com/wp-content/uploads/2015/11/mediator-software-design-pattern.gif

Source code example

https://dzone.com/articles/design-patterns-mediator
More to follow...

No comments:

Post a Comment

Software Engineering: Bad Smells! (Smelly code)

Bad Smells! What are bad smells? This refers to any symptom in the source code of a program that possibly indicates a deeper problem.  ...