Building observability into BasicProperty (Well, adding a module that provides it, anyway...)

Couldn't sleep, so decided to enhance a demo I wrote a few days ago when someone asked about how to do observable fields/properties in Python. OpenGLContext's VRML97 scenegraph is built out of observable fields, and we have a number of observable BasicProperty sub-classes in Cinemon, but BasicProperty itself hasn't had a "standard" observability story.

Backing off a second, by observable, I mean that on set or delete of a property, a message is sent in such a way that interested observers can register to receive the notification without the sender knowing anything about them. This is very useful in the Model:View:Controller pattern, and IIRC is considered a pattern in its own right.

Anyway, the demo I wrote worked perfectly well, but it only created a base BasicProperty class, and only sent messages on set (not delete). I've just enhanced it so that the module now has all of the classes in the "common" module, and sends both set and delete messages.

Usage is fairly straightforward:


Comments are closed.


Pingbacks are closed.