[Zope3-dev] defining interfaces

Steve Alexander steve@cat-box.net
Sun, 06 Apr 2003 00:05:40 +0200


>   The entropy of the Universe increases
>   -- 2nd Law of Thermodynamics

Sure, entropy wins in the long-run :-)


>>The two alternatives I'd recommend are:
>>
>>1:
>>     project.py
>>     iproject.py
>>
>>2:
>>     project/
>>     project/interfaces.py
>>
>>   or, if you have lots of interfaces
>>
>>     project/
>>     project/interfaces/
> 
>
> A generous "two" ;-)
 >
> Some questions:
> 
>  - When would you recommend option 1 for developer? I would imagine that
> namespace qualification of modules would be strongly recommended for
> anything meant to plug into Zope 3.

Perhaps I misunderstand what you said. Namespaces don't really come into 
this. You'd choose an appropriate package to put your project in for 
either case.

For example:

   foo/baz/project.py
   foo/baz/iproject.py

It is definitely a bad idea to take up more top-level names than 
necessary if you want your project to be widely used.


> - In the event that "best practices" recommends that projects should be
> defined in some sort of package structure, could we eliminate option 1
> above?

I think so. Option 1 is really only for single-module projects.


> This would leave the relatively simple decision of whether to
> define interfaces in a module or a package, presumably based on the size
> and complexity of the API.

Right.

--
Steve Alexander