Implementation of IBuyable or Interface?

Marcelo de Moraes Serpa celoserpa at gmail.com
Wed Jan 30 05:45:00 EST 2008


Hi Gabriel, thanks for the reply.

It's hard to tell just with that description. If you have to distinguish
> between a Product and a Service, specially if you have to do things with
> one that aren't done with the other (so they have a different set of
> methods), I'd say they should be different interfaces.
> Of course you may have several classes implementing the same interface
>

Thanks, that made things clearer for me. If a service will be used by
another object that expects different methods then it might as well
implement a different interface but still be a buyable so that it can be
used where a other buyables are expected (and maybe also using the more
specific methods by upcasting it). And yes, Products and Services will
probably have different methods and attributes.

BTW, what do you use to define the interface? zope.inteface? another
> package?
>

Yes, I'm using zope.interface.

Cheers,

Marcelo.

On Jan 29, 2008 8:46 PM, Gabriel Genellina <gagsl-py2 at yahoo.com.ar> wrote:

> En Tue, 29 Jan 2008 15:52:58 -0200, Marcelo de Moraes Serpa
> <celoserpa at gmail.com> escribi�:
>
> > I've got a IBuyable interface. The app can sell both Products and
> > Services
> > (Both "Buyables"). I'm not sure if Product and Service should also be
> > represented as interfaces (inherited from IBuyable) or if they are
> > actually
> > directly implementations of IBuyable.
>
> It's hard to tell just with that description. If you have to distinguish
> between a Product and a Service, specially if you have to do things with
> one that aren't done with the other (so they have a different set of
> methods), I'd say they should be different interfaces.
> Of course you may have several classes implementing the same interfaces.
>
> BTW, what do you use to define the interface? zope.inteface? another
> package?
>
> --
> Gabriel Genellina
>
> --
> http://mail.python.org/mailman/listinfo/python-list
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20080130/d29e759d/attachment-0001.html>


More information about the Python-list mailing list