[Zope3-dev] Re: Basic Interfaces question
Jim Washington
jwashin at vt.edu
Mon Jun 7 11:22:23 EDT 2004
Philipp von Weitershausen wrote:
> Jim,
>
> > Let's say we have an interface IFoo and an interface IFooExtended
> >
> > IFoo defines foo as
> >
> > def foo():
> > """do foo"""
> >
> > IFooExtended defines foo as
> >
> > def foo(myParam=None)
> > """do the same thing as foo in IFoo, except use myParam to extend
> > behavior if available"""
> >
> > should IFooExtended descend from IFoo, or should IFooExtended be a
> > different interface?
> >
> > i.e., should the definition of IFooExtended be
> >
> > class IFooExtended(IFoo):
>
> Usually you would subclass the IFoo interface, but it really depends on
> the meaning you attach to IFooExtended. Are things that are IFooExtended
> also IFoo? Judging by the name IFooExtended, I would think so, but it
> depends on the meaning you want to give it.
>
Yes, IFooExtendeds would also be IFoos; the question is whether the
optional parameter makes foo() a sufficiently different interface to
necessitate a complete interface definition. I presume that
implementation classes could implement both. Are there technical reasons
that a minor interface extension like this would make redefinition
desirable?
-- Jim Washington
More information about the Zope3-dev
mailing list