jang: (Default)
[personal profile] jang
The register is a rag, let's face it. Here's an example: Code inheritance and reuse: a delicate balancing act. Read down the first page.

[[[
Changes to the external protocol

When a subclass adds new methods that are available outside the class, it changes the external protocol of the superclass. This happens in a number of different situations:

...

* The subclass restricts methods provided by the superclass. This may include removing methods, or changing method parameters to types that are more restrictive. Currently, there is no way in Java to restrict the methods inherited from a class.
]]]

Nor will there ever be. How very 90s: the author doesn't understand what "is-a" means. Clueless feckwit.

Note, it's perfectly OK for a subclass to provide a method that accepts broader types as parameters, or whose return type specification is a subtype of the parent method's. (Although the JVM has a little trouble with this due to the way it locates methods; you have to fake this, but that's an implementatino detail.)

One might find it surprising that the author doesn't mention contracts in his discussion of componentisation. On the other hand, the error here wouldn't be made by someone who understood them.
From:
Anonymous( )Anonymous This account has disabled anonymous posting.
OpenID( )OpenID You can comment on this post while signed in with an account from many other sites, once you have confirmed your email address. Sign in using OpenID.
User
Account name:
Password:
If you don't have an account you can create one now.
Subject:
HTML doesn't work in the subject.

Message:

 
Links will be displayed as unclickable URLs to help prevent spam.

Profile

jang: (Default)
jang

October 2011

S M T W T F S
      1
2345678
9101112131415
16171819202122
23 242526272829
3031     

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Jul. 25th, 2017 12:43 pm
Powered by Dreamwidth Studios