Re: observer pattern question #1 (reference to subject)

2008-05-08 Thread castironpi
On May 8, 4:57 pm, Alan Isaac <[EMAIL PROTECTED]> wrote: > Ville M. Vainio wrote: > > in case of stocks, you are probably monitoring several > > stock objects, so the stock should probably pass itself to > > the observer > > OK.  This is related to my question #2 (in a separate > > thread), where I

Re: observer pattern question #1 (reference to subject)

2008-05-08 Thread Alan Isaac
Ville M. Vainio wrote: in case of stocks, you are probably monitoring several stock objects, so the stock should probably pass itself to the observer OK. This is related to my question #2 (in a separate thread), where I'd also appreciate your comments. analogous to a typical U

Re: observer pattern question #1 (reference to subject)

2008-05-08 Thread Ville M. Vainio
Alan Isaac <[EMAIL PROTECTED]> writes: > the following: "OK, here's the pattern, now your listener > wants to know the event source, do not ask something new the > subject to respond to that need. That is unnecessary > coupling. Instead, just rewrite your listener to maintain > a reference to th

Re: observer pattern question #1 (reference to subject)

2008-05-08 Thread Alan Isaac
Alan Isaac <[EMAIL PROTECTED]> writes: Is anything lost by not maintaining this reference (other than error checking ...)? If I feel the observer needs access to the subject, what is wrong with just having the subject pass itself as part of the notification? Ville M. Vainio wrot

Re: observer pattern question #1 (reference to subject)

2008-05-08 Thread Ville M. Vainio
Alan Isaac <[EMAIL PROTECTED]> writes: > Is anything lost by not maintaining this reference (other > > than error checking ...)? If I feel the observer needs > > access to the subject, what is wrong with just having the > > subject pass itself as part of the notification? It reduces the number

observer pattern question #1 (reference to subject)

2008-05-08 Thread Alan Isaac
I have two questions about the "observer pattern" in Python. This is question #1. (I'll put the other is a separate post.) Here is a standard example of the observer pattern in Python: http://en.wikipedia.org/wiki/Observer_pattern Contrast with this rather standard discussion: http:/