What is the need for Mediator Pattern in C#?Mediator
pattern concentrates about how you establish interaction between objects.
Generally objects interact by passing messages to one another directly.
This enforces strong coupling between objects. To reduce this coupling and to have a mediator class to mediate between two objects, you implement mediator pattern. Here is a sample code of mediator class: public class
mediatorClass { This is just
a partial code snippet. Your program should also include an abstract class
called baseClass that contains mediatorClass instance as its member. This
baseClass is inherited by two classes namely derivedClass1 and derivedClass2.
In mediatorClass, you create instances of these two derived classes and
achieve communication among them using the sendMessage method. Note that
your derived classes should implement the method notifyCommunication.
|