When will you use the reseller design pattern

As indicated in the title, when do you recommend using the mediator design pattern and where do you use it incorrectly?

+7
language-agnostic design-patterns mediator
source share
3 answers

Use a mediator when the complexity of linking objects begins to impede the reuse of the object . This type of complexity often appears in viewing examples, although it can really be anywhere.

Improper use of the mediator can lead to damage to the interfaces of the classes of fellow intermediaries.

It seems a little ridiculous to talk about the misuse of the template. If your implementation matches the pattern, you used the pattern. Otherwise, you did not. In other words, if your intermediary is doing something else, then he is probably not an intermediary. Templates are determined by what they do, what they really are. The names of things are just labels.

The real question is: do you ask if your implementation matches the promises pattern for your design. The mediator scheme is aimed at encapsulating complex inter-object communication when it becomes uncontrollable. If he did not achieve this or did not do it very well, you could say that the intermediary is being used incorrectly. At some point, he becomes a value judgment.

+19
source share

I used it to work with swing applications.

When I create a graphical interface, I don’t like that each control knows each other because it requires a subclass.

Instead, I have a Main object that contains a listener and widgets and allows it to mediate between various controls, buttons, text fields, etc.

+1
source share

The mediator is also basically a pump event. A very common picture in the graphical interface and games.

I also used the pick before to communicate between very collapsible systems and legacy frameworks.

+1
source share

All Articles