Consider the following hypothetical people management system. Suppose each Person
object belong to a number of Group
objects and each Group
contains a number of Person
objects. We could represent it by adding a list
to each Person
and each Group
object, but then we have to keep this in sync when we create, delete or modify an object. On change callbacks won't work well in this situation as they could lead to an infinite loop.
Now suppose each Group
has a name and a description. The name is stored in a dict
so that we can find which group uses which name and the description is indexed so that we can search it. These need to be updated whenever a group changes.
The application has a GUI which can display the Person
and Group
. Whenever a property of the object changes, the GUI needs to update.
Suppose we have to deal with a large number of effects like this. Keeping track of this is rather confusing. I could imagine these using properties, custom collections or maybe even metaclasses. Are there any design patterns/frameworks for dealing with these kind of systems?