[Zope3-dev] Re: ObjectHub

Gary Poster gary@zope.com
Sat, 07 Dec 2002 09:33:50 -0500


Steve Alexander wrote:

> We could be explicit about this and have an 'ensureRegistered' method.
> 
>   def register(object_or_location):
>       '''Register the given location.
> 
>       Returns the tuple (hubid, is_new_registration)
>       '''
> 
>   def ensureRegistered(object_or_location):
>       '''Ensure the given location is registered.
> 
>       Returns the hubid of the location.
>       '''
> 
> But, I think that this a YAGNI.

I would switch the two--the behavior of "register" as you have it there 
is more of a YAGNI to my eyes, and "ensureRegistered"'s behavior is the 
one we should have now until we actually want the extra information that 
the other provides.i.e.:

# YAGNI for now
#   def verboseRegister(object_or_location): # or whatever name
#       '''Register the given location.
#
#       Returns the tuple (hubid, is_new_registration)
#       '''

    def register(object_or_location):
        '''Ensure the given location is registered.

        Returns the hubid of the location.
        '''

That said, I'm keen on just doing something and moving forward.  I'm ok 
with your original proposal, I just don't love it.  Barring anyone 
coming over to my side, let's just agree on yours.

Thanks

Gary