D
Daniel O'Connell [C# MVP]
Jeremy Todd said:Because they weren't necessarily identical for all implementations.
Suppose you had interfaces IMass, which has a property which returns the
mass of some item, and IWeight, which returns its weight. For class
GoldBrick, the implementations of those would be (mostly) identical. For
class HotAirBalloon, they'd be very different.
Yes, but I'd argue that IMass.Mass and IWeight.Weight, even if they work the
same in one situation, are entirely different and as a matter of
understanding using the same method to implement them isn't going to make
code that makes immediate sense. Although I can't think of a physics example
to qualify it. Once you do that, how do you seperate them again in a derived
class? You could say I don't like the conceptual muxing of different ideas
for convenience.
That's horribly oversimplified, of course, but it gives the general
idea.
What about implementations of non-public interfaces?
How often are non-public interfaces on public types a good idea? IMHO not
very often. You should be designing your architecture so that public
types contain mostly publically accessible functionality(or underlying
protected functionality for virtuality). However, that is my personal POV.