Benji York wrote:
Derek Richardson wrote:
I wrote most of it today and there is more code shared between the two than is different. The main differences are:

* OOBTrees, instead of an IOBTree and an OIBTree
* Different events are fired when an object is registered and unregistered (they could be merged, but this is easy backwards-compatibility)
* _generateId() is, of course, different

The rest is pretty much copied and pasted, even most of the tests.

This suggests to me that you instead want to /use/ an int ID utility, not /be/ (a mutated) one. Unless there's a very compelling reason to copy all that functionality composition would be much cleaner.

I definitely don't want to be an *int* id utility. I may want to be, however, a uuid variety of an *id* utility, of which another variety would be int, and perhaps others, as well.

I see no compelling reason to copy all that functionality, which is why I'm exploring alternatives.

*Using* an int id utility, though, doesn't seem to cleanly solve the problem, which makes me wonder if I'm understanding you. If you mean use the intid utility to map keyrefs to int ids and then map int ids to uuids, this has a few problems. What I want to vary is the implementation - I want to keep the same interface. This would be keeping, and adding another layer to, the implementation and I'll still have to re-implement the interface on top of it. That's more work than just copying and doesn't reduce the copying at all, as I see it. Plus, it'll be (perhaps marginally) slower.

If you mean use the intid utility by instantiating one and then changing the data structures and _generateId() and the events at runtime, this would indeed solve the need to copy and paste. However, this seems like an obfuscating solution - who would guess that what is masquerading as an intid utility is really a uuid utility? Perhaps that's my static-typing background speaking, but it seems cleaner to have an "abstract" id utility and then write 10 lines of code to subclass and turn it into an int id utility and then another 10 lines for uuids.

I sense that I'm missing the point here. Perhaps you can elaborate on what you mean when you say "use" and "collaboration." I usually know what those terms mean, but I'm not sure I am getting it in this context.


Zope3-users mailing list

Reply via email to