[Zope3-dev] interface conventions: default=_RAISE_ERROR

Gary Poster garyposter@earthlink.net
Fri, 10 May 2002 20:19:41 -0400


On Friday 10 May 2002 07:54 pm, Steve Alexander wrote:
> Gary Poster wrote:
> > Instead, my suggestion is to place
> >  _RAISE_ERROR=Object()
>
> It needs to be object(), not Object()

heh.  I knew that.  Been writing in other languages lately.  Sorry.

> > in the __init__ of the Interfaces package.  An interface that wants to
> > use the default marker would simply
> > from Interface import Interface, _RAISE_ERROR
> > and implementations could import from their interfaces or from the
> > original declaration in the Interface package.
>
> I really wouldn't bother. It saves very little typing, adds to the
> complexity of finding out what things really mean, adds another
> dependency, and saves a few hundred bytes at most per runtime.

I disagree that it adds to complexity in 
readability.  The dependency is upon the Interface package, upon which an 
interface (and any component) is dependent upon anyway.

But the savings in both typing and efficiency are minimal, agreed.  So why 
bother?

My argument is for gracefulness, and perhaps for some small reduction in 
fragility.  I think it is clunky, for instance, for the placeful component 
architecture functions to have to check for their own default marker 
interface and then translate their default marker interface to the particular 
service default marker interface, if found.  If you do not agree with my 
suggestion, the placeful component architecture functions have to import the 
individual markers for each of the services at the top of the module, the 
coder has to make sure that the correct service marker is substituted for the 
placeful CA marker, and all of a suden you are talking about a lot of fluff 
code that just swaps some objects around.  Why?