C
cstratelos
Hello,
I have a question that concerns the Observer Design Pattern.
Why does every book and article that I have read on the topic does not
consider the fact that when the Observable notifies its Observers it
goes through a loop without starting a new thread for its Observer.
What I'm saying is that when you register with an Observable for
notifications, you do not want to depend on other Observers, that may
have already registered before you, to consume the notification
asynchronously.
For instance if there is only one Observer that has registered before
you then when the Observable will go through the loop:
Pseudocode:
foreach Observer o in myObservers
o.notify()
So if that first Observer takes forever to return from the notify()
call, or even worse never returns, you, who registered second, will
never get the notification.
Any thoughts??
thanx
costrat
I have a question that concerns the Observer Design Pattern.
Why does every book and article that I have read on the topic does not
consider the fact that when the Observable notifies its Observers it
goes through a loop without starting a new thread for its Observer.
What I'm saying is that when you register with an Observable for
notifications, you do not want to depend on other Observers, that may
have already registered before you, to consume the notification
asynchronously.
For instance if there is only one Observer that has registered before
you then when the Observable will go through the loop:
Pseudocode:
foreach Observer o in myObservers
o.notify()
So if that first Observer takes forever to return from the notify()
call, or even worse never returns, you, who registered second, will
never get the notification.
Any thoughts??
thanx
costrat