About the cons of the push model of the observer pattern

19 views
Skip to first unread message

nguillot

unread,
Dec 1, 2008, 8:19:27 AM12/1/08
to Software Architectures
Hello.

On a project we implemented the observer pattern with the push model
approach: the interface of a observer provide several notifications
functions, emitted by a subject.

Generally we can read that the push model gives less reusable
observers, and the subject makes assomptions about observers that can
not be always true.

My questions is about the differences about that cons in the 2 models:
push / pull.

For me, a subject should notify its observers each time a functional
event occurs. In the pull model, if we have forgotten a functional
specification of the subject, an observer which would need to react to
this event could not because the subject has no state for that.
In both model we need to implement some new things: in the pull model:
the subject should provide new informations for its observers, in the
pull model, we would add a new functional notification in the observer
interface.
But I think in those 2 cases, the coupling between subject and
observers is the same: I don't see why the subject would make more
assumptions about its observers in the push model; or why the observer
would be less reusable.

Maybe a concrete example of subject observer would help to illustrate
this thread: I could add one if some people are interested about this
topic.

thanks

Nicolas.

Reply all
Reply to author
Forward
0 new messages