Re: Debate on use of sub interfaces and poly-morphism
From: Chris Uppal (chris.uppal_at_metagnostic.REMOVE-THIS.org)
Date: 09/27/04
- Next message: Chris Uppal: "Re: How to set Http Request Header?"
- Previous message: Chris Uppal: "Re: Good idea or full of it?"
- In reply to: Christian Bongiorno: "Debate on use of sub interfaces and poly-morphism"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 27 Sep 2004 10:19:10 +0100
Christian Bongiorno wrote:
> So, basically the debate boils down to this:
> Do I use generic types in a super interface to reduce copy & paste
> (something I despise) or do I apply C&P to a few interface methods and
> thus enforce specific subtypes and relieve the caller of casting?
Doesn't it depend on /why/ the duplication exists ?
If the interfaces have these elements in common because they mean the same
thing, and because it is semantically /necessary/ for them to share those
members (so that, for instance, if one changes then they all change), then you
should express that fact by factoring out the common interface.
If, OTOH, it is only a sort of coincidence that they are so similar (as sounds
likely to me), then using common interface would be actively misleading.
(Especially in the absence of C++-style private inheritance, which can be used
for such cases where it is expedient to inherit functionality, but the
inheritance doesn't really /mean/ anything.)
-- chris
- Next message: Chris Uppal: "Re: How to set Http Request Header?"
- Previous message: Chris Uppal: "Re: Good idea or full of it?"
- In reply to: Christian Bongiorno: "Debate on use of sub interfaces and poly-morphism"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|