Re: Interface freeloading on a superclass - is it good practice?
- From: "jan V" <nul@xxxxxx>
- Date: Wed, 17 Aug 2005 15:46:25 GMT
> I'm not sure I understand how this is primarily a "bad use of
interface"
> problem as opposed to a "depending on undocumented behaviour" problem. I
Not even necessarily "undocumented behaviour". How many times have you seen
the latest JDK release notes state in the incompatible changes section
"method x was broken in our previous releases. It has now been reimplemented
to do X, and X is from now on the official documentation for that method x."
? In an ideal world that would never happen, but we live in a far-from ideal
reality...
> think you'd have the exact same problem if you used one of Sun's classes
in
> composition and depended on a particular behaviour; if Sun changed the
> behaviour, your code wouldn't work anymore.
Of course, but the OP will compound the problem by creating an interface at
the *top* of a hierarchy... breaking everything downstream if Sun fiddles
the semantics of one of "his" methods. That's at least as bad as some
regression bugs due to delegating (composition) to objects whose behaviour
have subtly changed from one JDK release to the next.
> I'd imagine typically that if one were to create an interface for a
> particular set of methods from one of Sun's classes, the documentation
> explaining the semantics of those methods would pretty much be taken
> straight from Sun's javadocs. Then the interface creates no new
restrictions
> on behaviour that weren't already publicly documented on Sun's site.
True, true, but the OP is not the prime maintainer of those semantics and
their documentation... Sun is. And that's the whole problem. Nobody can just
take snapshots of implementations by way of declaring an interface for
existing core API methods, and expect third parties like Sun to suddenly
honour those frozen semantics for the rest of time.
Right, I think I flogged my explanation to death... you either get it or you
don't... I gave it my best shot :-)
.
- 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
- Re: Interface freeloading on a superclass - is it good practice?
- From: jan V
- Re: Interface freeloading on a superclass - is it good practice?
- From: Oliver Wong
- Interface freeloading on a superclass - is it good practice?
- Prev by Date: Re: JNI, call java from C++.
- Next by Date: Re: subclass DeflaterOutputStream just to get bytes written?
- 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
|
|