Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #33417
| From | j4n bur53 <janburse@fastmail.fm> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: How to write constructor for an abstarct class? |
| Date | 2015-12-28 22:47 +0100 |
| Organization | albasani.net |
| Message-ID | <n5sam1$r7v$1@news.albasani.net> (permalink) |
| References | (2 earlier) <n5ruh8$478$1@news.albasani.net> <n5rur8$4p1$1@news.albasani.net> <n5rv13$4vh$1@news.albasani.net> <96fe5a20-3ea4-4578-89c7-4f7e324fcfd0@googlegroups.com> <n5s9e0$ol3$1@news.albasani.net> |
No, putting trolling aside.
There are a couple of reasons for abstract classes.
1) There is a certain design school which says base
classes should be always abstract, only non-base
classes should not be abstract.
Example from Swing (didn't check): Shape, it
has subclasses like Ellipse2D, Rectangle2D etc..
The design rule is often broken, like we might
have Point2D, and then suddently a NamedPoint2D,
without a common abstract super class.
2) Prior to default methods in interfaces, an abstract
class could be used in place of an interface,
provided extending this abstract class is all that
is needed.
Example from Swing (didn't check): AbstractButton
Could also go with an interface that specifies
what a button is, could then create hermaphrodites
like a table which is also a button (well, probably
doesn't make sense, but anyway)
The error message of the compiler is both an advantage
and drawback. The advantage is that the developer is
reminded what methods need to be implemented.
The disadvantage is that the design is rendered fragile.
If I decide to add one more abstract method, all sub-
classes don't compile anymore.
3) Spaghetti Monster, is it abstract or concrete?
if it is abstract, no instances would exist, but we
can see it. Its a knawel of spaghetti with two meat
balls. So I guess its not abstract.
Bye
j4n bur53 schrieb:
> Eric Douglas schrieb:
>> The real question is why would you want an abstract Shape?
>
> The real question do we see the spaghetti monster in the shape.
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
How to write constructor for an abstarct class? Xue Feng <xf.lotus@yahoo.com> - 2015-12-28 20:44 +0800
Re: How to write constructor for an abstarct class? Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-12-28 08:21 -0500
Re: How to write constructor for an abstarct class? Jan Burse <janburse@fastmail.fm> - 2015-12-28 19:20 +0100
Re: How to write constructor for an abstarct class? Jan Burse <janburse@fastmail.fm> - 2015-12-28 19:25 +0100
Re: How to write constructor for an abstarct class? Jan Burse <janburse@fastmail.fm> - 2015-12-28 19:28 +0100
Re: How to write constructor for an abstarct class? Lew <lewbloch@gmail.com> - 2015-12-28 10:40 -0800
Re: How to write constructor for an abstarct class? Eric Douglas <e.d.programmer@gmail.com> - 2015-12-28 10:42 -0800
Re: How to write constructor for an abstarct class? Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-12-28 14:29 -0500
Re: How to write constructor for an abstarct class? j4n bur53 <janburse@fastmail.fm> - 2015-12-28 22:26 +0100
Re: How to write constructor for an abstarct class? Eric Douglas <e.d.programmer@gmail.com> - 2015-12-28 13:37 -0800
Re: How to write constructor for an abstarct class? j4n bur53 <janburse@fastmail.fm> - 2015-12-28 22:47 +0100
Re: How to write constructor for an abstarct class? Eric Douglas <e.d.programmer@gmail.com> - 2015-12-28 13:58 -0800
Re: How to write constructor for an abstarct class? j4n bur53 <janburse@fastmail.fm> - 2015-12-28 23:06 +0100
Re: How to write constructor for an abstarct class? Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-12-28 17:43 -0500
Re: How to write constructor for an abstarct class? Lew <lewbloch@gmail.com> - 2015-12-28 15:14 -0800
Re: How to write constructor for an abstarct class? j4n bur53 <janburse@fastmail.fm> - 2015-12-29 15:02 +0100
Re: How to write constructor for an abstarct class? Arne Vajhøj <arne@vajhoej.dk> - 2015-12-29 15:37 -0500
Re: How to write constructor for an abstarct class? Arne Vajhøj <arne@vajhoej.dk> - 2015-12-29 15:28 -0500
Re: How to write constructor for an abstarct class? Arne Vajhøj <arne@vajhoej.dk> - 2015-12-29 15:21 -0500
Re: How to write constructor for an abstarct class? Arne Vajhøj <arne@vajhoej.dk> - 2015-12-29 15:22 -0500
Re: How to write constructor for an abstarct class? j4n bur53 <janburse@fastmail.fm> - 2015-12-29 16:24 +0100
csiph-web