[Zope3-dev] Re: ObjectHub
Gary Poster
gary@zope.com
Sat, 07 Dec 2002 09:15:43 -0500
Steve Alexander wrote:
> Can you explain what you want in terms of the Requirements for the
> 'register' method that I posted?
>
> Here they are again:
>
> * Postcondition: the given object's location is registered
>
> * If the postcondition cannot be met, you get an exception
>
> Otherwise...
>
> * You want to know the hubid of the registration
>
> * You want to know whether registration did any work
>
> I'd like to start by finding out if the requirements for this method are
> reasonable. Then, we can move on to think about how we spell it.
Sure. I think the first three are great. The last one feels somewhat
questionable to me, but then you gave a use-case in your code, so ok, I
guess. If you didn't have the last requirement, of course, you could
always just return the hubid:
>>> hub.register('/foo/bar/baz')
23
>>> hub.register('/foo/bar/baz')
23
Is the use case you gave for requirement 4 a reasonable one? My
response is, again, +0.
I see it, but grudgingly: I want to say YAGNI.
>> > There's a similar issue with 'unregister': it raises a
>> NotFoundError if
>> > the object/location is not registered.
>> >
>> > We can change 'unregister' to return a bool. This is fine, as it
>> > currently does not return anything meaningful.
>>
>> +.5: if the change above is implemented,, +1, and if not, -0.
>
>
> I'm drawing on experience from the Zope2 ZCatalog here: raising an
> exception for unregistering an object twice isn't all that helpful. The
> second unregistration isn't harmful. If you want to log this as an
> warning, the application method that calls 'unregister' can do that.
Agreed, and thus the full +1 in the first case. All I want is
reasonably parallel behavior between register and unregister: I don't
want one to raise an error and the other to not raise an error.
Gary