vendredi 3 janvier 2020

Does Mediator die when Colleague dies?

I have this question related to Mediator Design Pattern, which is of Behavioral category of GoF. I am trying to write a C# project using Design Pattern principles. Let's say this is a Colleague class:

abstract class Colleague
{
    Mediator mediator;
    // ...
}

And a Mediator class:

class Mediator
{
    List<Colleague> colleagueList;
    // ...
}
  • We can have a lot of colleagues: c1, c2, c3, ...
  • And a single Mediator: mediator

The mediator acts as a central point to allow communication between colleagues. Suppose at some point in our code, some Colleague dies. Will the Mediator object also die?

Aucun commentaire:

Enregistrer un commentaire