Re: c# events - 2 independent classes listening to each other?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance




Oliver Sturm wrote:
> john_teague wrote:
>
> >What you are referring to is the Observer pattern. Microsoft has a
> >article that explains the pattern and how to do this with events and
> >delegates.
> >http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnbda/html/observerpattern.asp
> >
> >You are essentially correct, in that the they must be wired up in the
> >aspx page. This article takes it a step further and puts a method in
> >the "Observer object" that acts as the delegate that "listens" for the
> >event in your second object.
>
> I'm sorry, but I don't think this is the right answer. Of course, an
> object listening to events from another object is an example of the
> observer pattern, but the specific problem here is that the objects don't
> have any reference to each other.
>
> I believe a much better pattern to suggest as a solution to the specific
> problem is the Mediator pattern. There's a good description with a quick
> introduction at the following URL:
> http://my.execpc.com/~gopalan/design/behavioral/mediator/mediator.html
>
>
>
> Oliver Sturm
> --
> Expert programming and consulting services available
> See http://www.sturmnet.org (try /blog as well)


Hi again, I just read about the mediator pattern and it does seem to
work well for my needs, I rattled yup a quick prototype and am quite
happy with how it hangs together.

I do appreciates everyones help on this, thanks!

.



Relevant Pages

  • Re: Observer pattern limitations
    ... but let's discuss it in the scope of the pattern. ... Observer pattern clearly shows the subject and a list of observers, ... And what about exceptions? ...
    (comp.object)
  • Re: Observer pattern limitations
    ... The title of the thread was "Observer pattern limitations". ... ""This reflects a sorry lack of formalism in the OO community" ...
    (comp.object)
  • Re: Observer pattern limitations
    ... The title of the thread was "Observer pattern limitations". ... The dirty reads and cycles in the graph are valid problems but I fail to see ...
    (comp.object)
  • Re: MVC-Pattern in my C# GUI !?!
    ... | May I advise that you can't "add" MVC in an application, ... the MVC pattern to an existing app that currently doesn't use the MVC ... | You should not have anything other than visual controls on your forms, ... | have wrapper classes that implement the Observer pattern and carry out the ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Question about Sun JAVAC
    ... > entered using the same case pattern as the file id's case pattern in ... Windows and MS-DOS file identifiers ignored case ... Seriously, though, just because microsoft decided to do things ... AFAIK, javac is *not* open source, so this will be yet ...
    (comp.programming)