0
Відповідь надано

Doesn't the mediator pattern violates open close principle

Somesh 3 тижні тому оновлено Alexander 3 дня тому 1

Every time a new component has to be added the notify in AuthenticationDialog needs to be modified, won't that violate the open close principle.

Image 1854

Відповідь надано

Hi!

It's indeed so, but depending on what your starting point, Mediator can be a lesser evel comparing to a spagetti mess. In some cases, you can aleviate this problem by implementing aspects of the Observer pattern, to make the notification more generic.