Question: Event driven programming
grahamd at dscpl.com.au
Sun Oct 28 03:30:02 CET 2001
Chris Liechti <cliechti at gmx.net> wrote in message news:<Xns914820011ACcliechtigmxnet at 220.127.116.11>...
> "Károly Ladvánszky" <aa at bb.cc> wrote in
> news:3bdb0140_5 at corp-goliath.newsgroups.com:
> > What I have in my mind is not necessarily UI related. In VB, objects
> > can raise events, objects interested in the events will handle them.
> > Thats a very simple mechanism, facilitates easy coding in many
> > situations, even if its just a console application with no GUI at all.
> > They are similar to exceptions but they return to the caller and they
> > can have parameters/return values of any kind.
> that sound like an "observer pattern" for me.... it is a common thing to do
> in OO languages. it's not a feature of a language but more a idea that can
> be implemented in various ways and languages.
> Java has an observer pattern implementation in it library, for Python you
> can take the code from the URL below.
> make a module with the "Subject" and "Observer" classes then you can simply
> inherit from them in your own classes.
Often in a GUI context, but not necessarily, also referred to as Model View
Controller (MVC), just depends on how the interaction is managed. Also, in
distributed system, often facilitated by a distributed publish/subscribe
mechanism. This takes separatation of subject and observer to the extreme
in the sense that interaction between the two isn't by direct application
of callbacks from subject to observer, but is mediated through an underlying
For distributed publish/subscribe mechanism in Python see example at:
More information about the Python-list