Re: Interface freeloading on a superclass - is it good practice?
- From: "jan V" <nul@xxxxxx>
- Date: Wed, 17 Aug 2005 07:45:01 GMT
> >So all in all, unless my prediction of trouble ahead is flawed, I think
you
> >need to go back to the drawing board on this one.,..
> >
> I fail to see your point.
> If Sun suddently changed the signature or function of, say,
java.awt.Component,
Who's talking about changing any method signatures? That's not what I said,
I wrote "reimplementing [methods], possibly with their functionality subtly
changed".. in other words I'm talking about the precise semantics of a
method being subtly changed. The method signature isn't touched at all.
The problem with your scheme is that
a) you pick arbitrary methods from abstract/concrete classes which are not
the subject of any interface contracts written by the same authors of the
classes
b) you define an interface which contains those same methods (as signatures
only, obviously), and by doing so you "freeze" a particular *semantic
contract* for these methods
c) you now subclass a third-party class (Sun's), and impose on this class
your interface's contract.
>From now on, any future changes to the *precise semantics* of the methods
you picked, as altered or enhanced or rewritten by Sun, may very likely
break your scheme.
Why? Because Sun don't know or care about your interface's rigid semantic
contract, but you do... and suddenly the methods you tagged as "belonging"
to your interface don't match the semantics you imposed on them. The Sun
changes lead to a branching in semantics for these methods: one branch for
Sun's semantics, and one branch for your interface's semantics. Now guess
who's going to loose the battle of this splitting evolution? You, not Sun,
since Sun aren't even aware some clever guy decided to try to impose a
semantic straightjacket on a subset of Component methods....
> So i am resting quite assured that it won't happen.
Do you understand the scenario now?
.
- Follow-Ups:
- Re: Interface freeloading on a superclass - is it good practice?
- From: Oliver Wong
- Re: Interface freeloading on a superclass - is it good practice?
- References:
- Interface freeloading on a superclass - is it good practice?
- From: Chris Berg
- Re: Interface freeloading on a superclass - is it good practice?
- From: Chris Berg
- Re: Interface freeloading on a superclass - is it good practice?
- From: jan V
- Re: Interface freeloading on a superclass - is it good practice?
- From: Chris Berg
- Interface freeloading on a superclass - is it good practice?
- Prev by Date: Re: returning multiple entities from a method
- Next by Date: Re: Multiple streams per file
- Previous by thread: Re: Interface freeloading on a superclass - is it good practice?
- Next by thread: Re: Interface freeloading on a superclass - is it good practice?
- Index(es):
Relevant Pages
|
|