[Zope3-dev] Re: Dependencie-handling

Shane Hathaway shane@zope.com
Tue, 01 Jul 2003 11:24:12 -0400


R. David Murray wrote:
> "Marcus J. Ertl" <marcus.ertl@larp-welt.de> wrote:
> 
>>At Zope3, there will be some products, they depend so some others. Will
>>be there some standard way of handling dependcies? Which is the right
>>way to :
>>
>>- check if a product is available
>>- check if all moduls are available
>>- to tell the administrator something is missing
> 
> 
> IMO, the right answer is none of the above <grin>.  Use Adapters
> and Interfaces and Services so that your product does not depend
> on another specific product, but rather on a set of Interfaces and
> Services.  That way someone can write a new module without having
> to change your module's code to work with it.  When an Adapter or
> Service that your module needs isn't available, an appropriate error
> message will result.  If you want to make the error message friendly,
> do some of the checking at initialization time and generate a
> specific message.

I agree, but I'd like to note that there's a little hole in this 
strategy that could become a burden: sometimes you want to depend on the 
interfaces defined by another product.  For example, there might be a 
product that defines IImageManipulator, and you want to adapt to that 
interface, yet you want a different implementation than what that 
product provides.

I know of two general solutions to this issue: GUIDs like Microsoft's 
CLSIDs, and URIs.  Both allow people to resolve to highly specific 
interfaces, while requiring no new central authority.  GUIDs are ugly, 
while URIs take advantage of the domain name system to allow people to 
make the identifiers readable.

There might be other solutions to the interface distribution issue, but 
creating a direct association between interfaces and URIs just seems 
like a great idea to me.  *shrug*

Shane