[Python-Dev] Oberver Pattern
Magnus Lie Hetland
magnus@hetland.org
Wed, 15 May 2002 22:40:52 +0200
Fredrik Lundh <fredrik@pythonware.com>:
>
> magnus wrote:
>
> > > > This could be very useful for GUIs, too, for implementing
> > > > model-view relationships. The anygui people would be very
> > > > interested, I'm sure.
> > >
> > > Indeed!
> > >
> > > have you actually built large-scale UI applications using a
> > > one-size-fits-all observer model, or are you just guessing?
> >
> > Guessing about what?
>
> the "very useful for implementing model-view relationships"
> part, of course.
>
> since you didn't reply to the "large-scale" part, and gave an
> example that doesn't really have much to do with model-view
> design (unless you're writing a GUI builder, perhaps) I assume
> you're still mostly guessing.
Hey - lighten up... If you read my answer, I was replying to the "The
anygui people would be very interested, I'm sure" part. I was
interested.
The reason the Anygui MVC architecture is the way it is is mainly to
avoid the need for notification in every little modification; with
observable built-ins this sort of thing would have to be handled in
another manner, of course. I'm not sure exactly how this should be
done, but, as I said, I am interested.
> if you want something closer to real-life, consider how well a
> "standard observer" would deal with the following example:
>
> # load the model
> dom = xml.dom.minidom.parse(filename)
>
> # create a view
> mywidget = MyDisplayView()
> mywidget.show(dom)
>
> # modify the model
> for element in dom.getElementsByTagName("sometag"):
> ...
I'm not sure I see your point here (although I'm sure it's entirely my
fault). Are you saying that there would be a problem because you would
get too many notifications? If so, I don't see how that's inherent in
being able to observe values belonging to built-in types (which is
what I'm interested in).
Oh, well. I guess it's not going to happen anyway, so this discussion
is probably going nowhere.
> </F>
--
Magnus Lie Hetland The Anygui Project
http://hetland.org http://anygui.org