[kforge-dev] temporal object question
John Bywater
john.bywater at appropriatesoftware.net
Mon Feb 4 20:16:10 UTC 2008
Hi Rufus,
Just on the topic of temporal properties and objects, I remembered you
saying about SQLAlchemy et al words to the effect, "they all have
version domain model." I can't seem to find where this is. Could you help?
Also, in my spare time I've taken my implementation of Fowler's patterns
a little bit further. I thought you might be interested to know that I
"figured out" that implementing temporal properties for one-many
attributes seems to require maintaining a record of the history of the
members of that collection, updated only when the property/object is
"saved". Then you can just look up what the members of the association
were, without somehow looking through the collected objects (which may
or may not themselves be temporal...), and with decent performance. If
you are implementing temporal one-many properties, you might need to do
this to make it work well. It seemed wasteful at first, but now I don't
think it is at all. Now I think it's just a different way of
implementing one-many, that is where the one- has a list of references
to collected objects, and those collected objects know nothing of being
collected.
The other thing I decided for myself is that there seems to be a
temporal domain of concern, which can be modelled. And I would think
that a good implementation of such temporal aspects in a more concrete
domain of concern would call upon (make use of) the temporal model (so
these two concerns are separated).
So, unless a domain model needs to extend the temporal model, I don't
think a normal domain model would itself derive objects from the
temporal model, but instead would have attributes (inherited from and
supported by the core) that are set according to the temporal aspects of
the real domain.
Anyway, this is the temporal model I came up with in domain model:
http://project.knowledgeforge.net/domainmodel/trac/browser/trunk/src/dm/dom/temporal.py
It is directed by the registry, to reflect the registered model, pretty
much from here:
http://project.knowledgeforge.net/domainmodel/trac/browser/trunk/src/dm/dom/registry.py#L64
And values are picked by the persistence model here:
http://project.knowledgeforge.net/domainmodel/trac/browser/trunk/src/dm/db.py#L771
http://project.knowledgeforge.net/domainmodel/trac/browser/trunk/src/dm/db.py#L867
It's fairly subtle, but pretty simple and very effective.
Anyway, I enjoyed working through those patterns. I think I understand
them much better now. And I'm sure the code will enhance KForge,
ScanBooker, Desire, Eternity, Provide, etc.
Best wishes,
John.
--
Appropriate Software Foundation
Registered in England and Wales
17 Chapel Street, Hyde Cheshire
Company number: 04977110
W: appropriatesoftware.net
T: 0870 720 2944
M: 0781 139 2292
More information about the kforge-dev
mailing list