Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #26495
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Eric Sosman <esosman@comcast-dot-net.invalid> |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: java inheritance |
| Date | Mon, 11 Nov 2013 09:12:23 -0500 |
| Organization | A noiseless patient Spider |
| Lines | 52 |
| Message-ID | <l5qokq$d7j$1@dont-email.me> (permalink) |
| References | <88bf3eb6-4f5a-4745-9bea-fcc4bdaba816@googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| Injection-Date | Mon, 11 Nov 2013 14:12:42 +0000 (UTC) |
| Injection-Info | mx05.eternal-september.org; posting-host="858a9d65d95f4ea4d355bd116aa2cdbf"; logging-data="13555"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+cUPN1jLWt8SWeyYd2l6nT" |
| User-Agent | Mozilla/5.0 (Windows NT 5.1; rv:24.0) Gecko/20100101 Thunderbird/24.1.0 |
| In-Reply-To | <88bf3eb6-4f5a-4745-9bea-fcc4bdaba816@googlegroups.com> |
| Cancel-Lock | sha1:DWmUCH9v86z8x4XXT4vqQfinYro= |
| Xref | csiph.com comp.lang.java.programmer:26495 |
Show key headers only | View raw
On 11/11/2013 8:30 AM, asdf9797 wrote:
> Hi
>
> I did a java test recently and one of the questions was on the subject of
> inheritance/ OO design
>
> The idea was there was a "Storable" abstract class which contained a store() method.
>
> There was a IStorable interface
>
> And then there was
>
> class Book extends Storable implements IStorable {
> public void save(Book) {
> }
>
> }
> The question was how to improve the implementation.
Fixing the syntax error would be a good start ...
> What is the current thinking on extending abstract classes ?
The current thinking is that an abstract class that's not
extended is very nearly useless. ;-)
> Is that the issue?
I don't know what the test-setters were looking for. Perhaps
the Storable class already implements IStorable, so the "implements"
part in Book is redundant. Maybe they felt the abstract class didn't
add value, and hoped you would discard "extends Storable". It's
possible they wanted the save() method to take any Storable (or
maybe IStorable) instead of insisting on a Book. Possibly all they
wanted was a trivial renaming, something along the lines of
interface Storable { ... }
abstract class AbstractStorable implements Storable { ... }
class Book extends AbstractStorable { ... }
Some design schemes are fairly rigid about such things -- make
an interface with THIS kind of name, and an abstract implementing
class with THAT kind of name, and so on and so on. If the testers
were aficionados of one such scheme, perhaps they were just trying to
find out whether you, too, were familiar with it. I'd say familiarity
with a particular set of conventions is not quite the same thing as
familiarity with Java and/or with O-O design -- but maybe that's not
what they were after.
--
Eric Sosman
esosman@comcast-dot-net.invalid
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
java inheritance asdf9797 <paul.caffrey@gmail.com> - 2013-11-11 05:30 -0800
Re: java inheritance Eric Sosman <esosman@comcast-dot-net.invalid> - 2013-11-11 09:12 -0500
Re: java inheritance Arne Vajhøj <arne@vajhoej.dk> - 2013-11-11 09:40 -0500
Re: java inheritance markspace <markspace@nospam.nospam> - 2013-11-11 09:45 -0800
Re: java inheritance Arved Sandstrom <asandstrom2@eastlink.ca> - 2013-11-18 09:24 -0400
Re: java inheritance Robert Klemme <shortcutter@googlemail.com> - 2013-11-11 19:19 +0100
csiph-web