Questions tagged [mediator]

The mediator pattern defines an object that encapsulates how a set of objects interact. It is one of the Gang of Four's behavioral design patterns.

This is one of the Gang of Four's behavioral , first published in Gamma et al.'s book "Design Patterns: Elements of Reusable Object-Oriented Software".

More information is available on Wikipedia.

437 questions
117
votes
8 answers

Mediator Vs Observer Object-Oriented Design Patterns

I have been reading the Gang Of Four, in order to solve some of my problems and came across the Mediator pattern. I had earlier used Observer in my projects for making some GUI application. I am a bit confused as I do not find great difference…
AnotherDeveloper
  • 2,161
  • 2
  • 23
  • 27
91
votes
8 answers

Façade vs. Mediator

I've been researching the difference between these two patterns. I understand that facade encapsulates access to a sub system and mediator encapsulates the interactions between components. I understand that sub system components are not aware of…
Tired
29
votes
6 answers

WPF MVVM dialog example

Does anyone have any examples of showing a window dialog using MVVM (Prism)? - for example a configuration settings window when a command is executed. All of the examples I've seen use the mediator pattern which is fine, but they also all have a…
Oll
  • 945
  • 1
  • 14
  • 23
19
votes
4 answers

What is the exact difference between 'Adapter' and 'Mediator" patterns?

I know that Adapter is a structural pattern and Mediator is a behavioral one. But as far I understood, what both of them are doing, is connecting two (or more) other classes which are potentially incompatible (not so maintainable) for direct…
17
votes
5 answers

Is Eventbus a Mediator or Observer Pattern?

Is Eventbus more a Mediator or an Observer? According to Google, "eventbus mediator" gets 2.430 hits and "eventbus observer" gets 3.850 hits. From the description, they would both match what I was trying to do (the mediator even a little more). So…
Stefan
  • 14,826
  • 17
  • 80
  • 143
16
votes
3 answers

When would you use the mediator design pattern

As the title states when would you recommend the use of the mediator design pattern and where do you see it used incorrectly?
hhafez
  • 38,949
  • 39
  • 113
  • 143
16
votes
2 answers

Is the use of the mediator pattern recommend?

I am currently reading http://addyosmani.com/resources/essentialjsdesignpatterns/book/#mediatorpatternjavascript I understand the mediator pattern as some sort of object which sets up publish and subscribe functionality. Usually I am setting up…
bodokaiser
  • 15,122
  • 22
  • 97
  • 140
13
votes
5 answers

Mediator pattern vs Publish/Subscribe

Can someone point out the main differences between the two? It seems that, at least conceptually, the two are very closely related. If I were to hazard a guess, I would say that the publish/subscribe method is a subset of the mediator pattern…
Kristian D'Amato
  • 3,996
  • 9
  • 45
  • 69
13
votes
1 answer

Observer Pattern vs Mediator Pattern

I did some googling and yes I know that questions about the difference between these two has been asked before on stackoverflow and all over the web. But I mostly find worded answers, which can be confusing. My question is if anyone here can please…
Borges Diaz
  • 133
  • 1
  • 4
11
votes
8 answers

What is an example in the real world that uses the "Mediator pattern"?

Could someone give a use-case example where the "Mediator pattern" is useful in the real world?
simon.denel
  • 780
  • 6
  • 23
10
votes
3 answers

global communication in angular module: event bus or mediator pattern/service

So far I have seen many solutions of the problem. The simplest one is, of course, to $emit an event in $rootScope as an event bus e.g. ( https://github.com/btilford/anti-patterns/blob/master/angular/Angular.md )…
8
votes
3 answers

Circular Dependency in mediator pattern using c#

I have a question regarding mediator pattern that I want to implement in my application(using C#). While implementing the pattern in my code I came across a circular dependency. The structure of the classes as follows: Mediator and Colleague…
GeekM
  • 81
  • 2
8
votes
1 answer

How to use Mediator inside Background Service in C# ASP NET Core?

I am trying to implement a background service, QueuedBackground service with Mediator. So far I am able to implement the queues but I am unable to execute Mediator. Interface public interface IBackgroundTaskQueueService { void…
supernerd
  • 379
  • 4
  • 13
8
votes
3 answers

Implementing the Mediator pattern in Delphi without getting circular references

For those that are familiar with the Mediator pattern... I want to implement the Mediator pattern in Delphi, but the Delphi compiler can't handle the circular references required. Looking at the original GOF diagram from 'Design Patterns', the…
awmross
  • 3,789
  • 3
  • 38
  • 51
7
votes
1 answer

Mediator C++ GUI sample

I have heard that somewhere @ web I'll be able to find good C++ example of Mediator working with GUI components. But I menaged to find only that GoF sample or things from sorcemaking and similar that aren't helpful to me. So... do you know where…
dantuch
  • 9,123
  • 6
  • 45
  • 68
1
2 3
29 30