Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #28242 > unrolled thread
| Started by | Roedy Green <see_website@mindprod.com.invalid> |
|---|---|
| First post | 2014-04-26 21:09 -0700 |
| Last post | 2014-04-27 07:32 -0400 |
| Articles | 18 — 10 participants |
Back to article view | Back to comp.lang.java.programmer
vocabulary Roedy Green <see_website@mindprod.com.invalid> - 2014-04-26 21:09 -0700
Re: vocabulary markspace <markspace@nospam.nospam> - 2014-04-26 21:25 -0700
Re: vocabulary "Qu0ll" <Qu0llSixFour@gmail.com> - 2014-04-27 17:30 +1000
Re: vocabulary Richard Maher <maher_rjSPAMLESS@hotmail.com> - 2014-04-27 14:42 +0800
Re: vocabulary Marcel Müller <news.5.maazl@spamgourmet.org> - 2014-04-27 08:59 +0200
Re: vocabulary "Qu0ll" <Qu0llSixFour@gmail.com> - 2014-04-27 17:33 +1000
Re: vocabulary Marcel Müller <news.5.maazl@spamgourmet.org> - 2014-04-27 12:21 +0200
Re: vocabulary "Qu0ll" <Qu0llSixFour@gmail.com> - 2014-04-27 20:23 +1000
Re: vocabulary Roedy Green <see_website@mindprod.com.invalid> - 2014-04-27 12:52 -0700
Re: vocabulary Martin Gregorie <martin@address-in-sig.invalid> - 2014-04-27 22:30 +0000
Re: vocabulary Marcel Müller <news.5.maazl@spamgourmet.org> - 2014-04-28 08:23 +0200
Re: vocabulary "Chris Uppal" <chris.uppal@metagnostic.REMOVE-THIS.org> - 2014-05-04 13:00 +0100
Re: vocabulary Eric Sosman <esosman@comcast-dot-net.invalid> - 2014-05-04 08:44 -0400
Re: vocabulary lipska the kat <lipskathekat@example.com> - 2014-04-27 09:01 +0100
Re: vocabulary "Qu0ll" <Qu0llSixFour@gmail.com> - 2014-04-27 19:53 +1000
Re: vocabulary lipska the kat <lipskathekat@example.com> - 2014-04-27 11:43 +0100
Re: vocabulary Jeff Higgins <jeff@invalid.invalid> - 2014-04-27 07:14 -0400
Re: vocabulary Jeff Higgins <jeff@invalid.invalid> - 2014-04-27 07:32 -0400
| From | Roedy Green <see_website@mindprod.com.invalid> |
|---|---|
| Date | 2014-04-26 21:09 -0700 |
| Subject | vocabulary |
| Message-ID | <8l0pl95jubrn24j0tgnqcc21arhkii83ko@4ax.com> |
Is there a word that means "class or interface"? -- Roedy Green Canadian Mind Products http://mindprod.com Computers are like Old Testament gods; lots of rules and no mercy. ~ Joseph Campbell (born: 1904-03-26 died: 1987-10-31 at age: 83)
[toc] | [next] | [standalone]
| From | markspace <markspace@nospam.nospam> |
|---|---|
| Date | 2014-04-26 21:25 -0700 |
| Message-ID | <lji0rq$qsv$1@dont-email.me> |
| In reply to | #28242 |
On 4/26/2014 9:09 PM, Roedy Green wrote: > Is there a word that means "class or interface"? > It depends on context I think, but "type" might work. Classes and interfaces in Java are most often used to implement new types. "Super-type" and "sub-type" work to describe relationships between classes and interfaces. Java is kind of weird too that it explicitly has an interface type. C++ uses pure virtual classes instead of "interfaces", so in that language they are all classes. It wouldn't be wrong to call an interface a class in Java. You can have a class object that is an interface, right? So interface is a sub-type of a class, a specific type of class with no method implementations. Classes can be abstract too, which is sort of like an interface, although some methods now may have an implementation.
[toc] | [prev] | [next] | [standalone]
| From | "Qu0ll" <Qu0llSixFour@gmail.com> |
|---|---|
| Date | 2014-04-27 17:30 +1000 |
| Message-ID | <ljibpu$8vg$1@speranza.aioe.org> |
| In reply to | #28243 |
"markspace" wrote in message news:lji0rq$qsv$1@dont-email.me... > Classes can be abstract too, which is sort of like an interface, although > some methods now may have an implementation. Yes, "default methods" in interfaces with Java 8 certainly blurs the lines between abstract class and interface. -- And loving it, -Qu0ll (Rare, not extinct) _________________________________________________ Qu0llSixFour@gmail.com [Replace the "SixFour" with numbers to email me]
[toc] | [prev] | [next] | [standalone]
| From | Richard Maher <maher_rjSPAMLESS@hotmail.com> |
|---|---|
| Date | 2014-04-27 14:42 +0800 |
| Message-ID | <lji8sm$2u0$1@speranza.aioe.org> |
| In reply to | #28242 |
On 4/27/2014 12:09 PM, Roedy Green wrote: > Is there a word that means "class or interface"? > Genre has been used a lot for class. Different language variants of Bridge can be useful for Interface in an aesthetically pleasing sort of way.
[toc] | [prev] | [next] | [standalone]
| From | Marcel Müller <news.5.maazl@spamgourmet.org> |
|---|---|
| Date | 2014-04-27 08:59 +0200 |
| Message-ID | <535caadc$0$6712$9b4e6d93@newsspool2.arcor-online.net> |
| In reply to | #28242 |
On 27.04.14 06.09, Roedy Green wrote: > Is there a word that means "class or interface"? -> object In Java object is anything except for built-in value types, i.e. any class or interface. Note that this may not apply to other OO languages. Marcel
[toc] | [prev] | [next] | [standalone]
| From | "Qu0ll" <Qu0llSixFour@gmail.com> |
|---|---|
| Date | 2014-04-27 17:33 +1000 |
| Message-ID | <ljibu5$98l$1@speranza.aioe.org> |
| In reply to | #28245 |
"Marcel Müller" wrote in message news:535caadc$0$6712$9b4e6d93@newsspool2.arcor-online.net... On 27.04.14 06.09, Roedy Green wrote: > Is there a word that means "class or interface"? -> object Huh? Isn't "object" an instance of a class or interface? I prefer "type" as suggested by markspace where object is an instance of a type (class or interface). -- And loving it, -Qu0ll (Rare, not extinct) _________________________________________________ Qu0llSixFour@gmail.com [Replace the "SixFour" with numbers to email me]
[toc] | [prev] | [next] | [standalone]
| From | Marcel Müller <news.5.maazl@spamgourmet.org> |
|---|---|
| Date | 2014-04-27 12:21 +0200 |
| Message-ID | <535cda24$0$6715$9b4e6d93@newsspool2.arcor-online.net> |
| In reply to | #28247 |
On 27.04.14 09.33, Qu0ll wrote: > "Marcel Müller" wrote in message > news:535caadc$0$6712$9b4e6d93@newsspool2.arcor-online.net... > > On 27.04.14 06.09, Roedy Green wrote: >> Is there a word that means "class or interface"? > > -> object > > Huh? Isn't "object" an instance of a class or interface? I prefer "type" > as suggested by markspace where object is an instance of a type (class > or interface). It is. But the OP didn't say whether he talks about types or instances. In case of type the correct term is "reference type". Although this is somewhat uncommon in the Java world since all types except for some built-ins are reference types. Marcel
[toc] | [prev] | [next] | [standalone]
| From | "Qu0ll" <Qu0llSixFour@gmail.com> |
|---|---|
| Date | 2014-04-27 20:23 +1000 |
| Message-ID | <ljilqs$vvv$1@speranza.aioe.org> |
| In reply to | #28252 |
"Marcel Müller" wrote in message news:535cda24$0$6715$9b4e6d93@newsspool2.arcor-online.net... > It is. But the OP didn't say whether he talks about types or instances. He refers to "class or interface" which are most definitely types, not instances surely? -- And loving it, -Qu0ll (Rare, not extinct) _________________________________________________ Qu0llSixFour@gmail.com [Replace the "SixFour" with numbers to email me]
[toc] | [prev] | [next] | [standalone]
| From | Roedy Green <see_website@mindprod.com.invalid> |
|---|---|
| Date | 2014-04-27 12:52 -0700 |
| Message-ID | <f2nql9dvkidjochtle75491kv8fnkpnllr@4ax.com> |
| In reply to | #28253 |
On Sun, 27 Apr 2014 20:23:03 +1000, "Qu0ll" <Qu0llSixFour@gmail.com>
wrote, quoted or indirectly quoted someone who said :
>He refers to "class or interface" which are most definitely types, not
>instances surely?
In the sense I am looking for a generic term,
a class is a some source code bracketed with class xxx { }
an interface is some source code bracketed with interface xxx { }.
One way of looking at it is it is a related group of methods.
In many cases whatever you can do with a class reference you can do
with an interface reference. You should not have spell out "class or
interface" reference. In that case reference does mean both by
default.
If I were designing Java syntax from scratch, perhaps I would have
would made interface a modifier, e.g. interface class cf. abstract
class. Then we would not have the awkward implements vs extends
distinction.
I wonder if we could deprecate extends and make it a synonym for
implements. If the defined is an interface, it implies the extends
meaning.
--
Roedy Green Canadian Mind Products http://mindprod.com
Computers are like Old Testament gods; lots of rules and no mercy.
~ Joseph Campbell (born: 1904-03-26 died: 1987-10-31 at age: 83)
[toc] | [prev] | [next] | [standalone]
| From | Martin Gregorie <martin@address-in-sig.invalid> |
|---|---|
| Date | 2014-04-27 22:30 +0000 |
| Message-ID | <ljk0dh$cmn$1@dont-email.me> |
| In reply to | #28270 |
On Sun, 27 Apr 2014 12:52:38 -0700, Roedy Green wrote:
> On Sun, 27 Apr 2014 20:23:03 +1000, "Qu0ll" <Qu0llSixFour@gmail.com>
> wrote, quoted or indirectly quoted someone who said :
>
>>He refers to "class or interface" which are most definitely types, not
>>instances surely?
>
> In the sense I am looking for a generic term,
> a class is a some source code bracketed with class xxx { }
> an interface is some source code bracketed with interface xxx { }.
>
> One way of looking at it is it is a related group of methods.
>
> In many cases whatever you can do with a class reference you can do with
> an interface reference. You should not have spell out "class or
> interface" reference. In that case reference does mean both by default.
>
> If I were designing Java syntax from scratch, perhaps I would have would
> made interface a modifier, e.g. interface class cf. abstract class.
> Then we would not have the awkward implements vs extends distinction.
>
> I wonder if we could deprecate extends and make it a synonym for
> implements. If the defined is an interface, it implies the extends
> meaning.
It seems to me that the only reason Java has both Abstract Class and
Interface definitions is to sidestep having to implement multiple
inheritance: if multiple inheritance was supported there would be no
difference between them. That said, I seldom use Interface definitions
but find the distinction can be useful.
--
martin@ | Martin Gregorie
gregorie. | Essex, UK
org |
[toc] | [prev] | [next] | [standalone]
| From | Marcel Müller <news.5.maazl@spamgourmet.org> |
|---|---|
| Date | 2014-04-28 08:23 +0200 |
| Message-ID | <535df3cf$0$6707$9b4e6d93@newsspool2.arcor-online.net> |
| In reply to | #28278 |
On 28.04.14 00.30, Martin Gregorie wrote: > It seems to me that the only reason Java has both Abstract Class and > Interface definitions is to sidestep having to implement multiple > inheritance: Yes the implementation of interfaces is different from that of classes. In fact this is the point where java already supports multiple inheritance. Accessing an interface requires another level of indirection because of this difference. > if multiple inheritance was supported there would be no > difference between them. This is exactly the way that C++ has gone. There the people claim that they need to write "public virtual Name" to implement an interface. And from time to time the "virtual" is missing, which leads to different and with respect to interfaces unexpected behavior. Others (accidentally) add data members to the interfaces which actually should not happen to interfaces. > That said, I seldom use Interface definitions > but find the distinction can be useful. Interfaces are used in Java quite often. Mainly to implement the PIMPL and/or the factory pattern. Marcel
[toc] | [prev] | [next] | [standalone]
| From | "Chris Uppal" <chris.uppal@metagnostic.REMOVE-THIS.org> |
|---|---|
| Date | 2014-05-04 13:00 +0100 |
| Message-ID | <qMGdnW2W7d7itvvOnZ2dnUVZ8kWdnZ2d@bt.com> |
| In reply to | #28278 |
Martin Gregorie wrote:
> It seems to me that the only reason Java has both Abstract Class and
> Interface definitions is to sidestep having to implement multiple
> inheritance
FWIW, I disagree with this entirely.
For me, as for [some] others, interfaces are an expression of a /contract/ --
they are used to communicate guarantees/requirements between producers and
consumers of APIs.
Abstract classes, on the other hand, are nothing to do with contractual
communication between programmers. They are skeleton implementations.
It's unfortunate that Java's syntax makes the two -- unrelated -- constructs
looks so similar. A different language might present the same concepts very
differently.
One language design that didn't conflate the two concepts would be not to allow
class names to appear in type declarations, but only interface names (with some
simple syntax for defining a class /and/ it's interface[s] at the same time).
Asking people to expound on the difference[s] between interfaces and abstract
classes used to be one of my favourite interview questions (in the days when I
did interviews -- now happily past). But I gave it up since it seemed that all
I ever got were canned responses along the lines of "you can include method
definitions in an Abstract class, you can't in an interface" (probably learned,
more-or-less by heart, at university).
So my answer to Roedy's question would be along the lines of:
"An optionally-top-level syntactic construct delimited by curlies {}." (That
covers enums too -- which I think is in the spirit of the question.)
Although in the contexts where interface names and class names are used as type
names, we can "cancel out" the "names" bit, and call them both types ;-)
-- chris
[toc] | [prev] | [next] | [standalone]
| From | Eric Sosman <esosman@comcast-dot-net.invalid> |
|---|---|
| Date | 2014-05-04 08:44 -0400 |
| Message-ID | <lk5cmr$qdg$1@dont-email.me> |
| In reply to | #28362 |
On 5/4/2014 8:00 AM, Chris Uppal wrote:
> Martin Gregorie wrote:
>
>> It seems to me that the only reason Java has both Abstract Class and
>> Interface definitions is to sidestep having to implement multiple
>> inheritance
>
> FWIW, I disagree with this entirely.
>
> For me, as for [some] others, interfaces are an expression of a /contract/ --
> they are used to communicate guarantees/requirements between producers and
> consumers of APIs.
>
> Abstract classes, on the other hand, are nothing to do with contractual
> communication between programmers. They are skeleton implementations.
> [...]
In what way does an abstract method declaration in an abstract class
differ from an abstract method declaration in an interface? ISTM that
all abstract methods, wherever embedded, impose identical "contractual"
requirements on their concrete implementations.
As for "skeleton implementations" ...
abstract class Abstract {
abstract void setThing(Object obj);
abstract Object getThing();
}
interface Abstruse {
void setThing(Object obj);
Object getThing();
}
There *is* a tiny skeletal shard to the former that the latter lacks:
Abstract has a constructor, while Abstruse does not. But Abstract's
constructor is pretty minimal: A mere bone splinter, not a structural
element that can support weight and anchor muscles. I think that if
you tried to argue that Abstract's trivial constructor amounted to an
"implementation," you'd get at best a grudging "Well, *technically*"
in response.
By the way, one of the more intriguing (to me) uses of an abstract
class is to "un-implement" something:
abstract class Disinheritor {
abstract String toString();
}
A subclass of Disinheritor must provide its own toString() method, and
cannot simply inherit Object's. So, does that make Disinheritor an
"anti-skeleton implementation" or a "skeleton anti-implementation?" ;-)
--
Eric Sosman
esosman@comcast-dot-net.invalid
[toc] | [prev] | [next] | [standalone]
| From | lipska the kat <lipskathekat@example.com> |
|---|---|
| Date | 2014-04-27 09:01 +0100 |
| Message-ID | <ptWdnfl58rD-JMHOnZ2dnUVZ8gUAAAAA@bt.com> |
| In reply to | #28242 |
On 27/04/14 05:09, Roedy Green wrote: > Is there a word that means "class or interface"? Abstraction unit -- lipska the kat - treacherous feline. Proudly nominated for IPOTY 2014 - LIGAF GNU/Linux user #560883 - linuxcounter.net
[toc] | [prev] | [next] | [standalone]
| From | "Qu0ll" <Qu0llSixFour@gmail.com> |
|---|---|
| Date | 2014-04-27 19:53 +1000 |
| Message-ID | <ljik6g$sa6$1@speranza.aioe.org> |
| In reply to | #28250 |
"lipska the kat" wrote in message news:ptWdnfl58rD-JMHOnZ2dnUVZ8gUAAAAA@bt.com... > On 27/04/14 05:09, Roedy Green wrote: >> Is there a word that means "class or interface"? > > Abstraction unit I have never heard it referred to like that. Couldn't an "abstraction unit" be an entire group of classes/interfaces (and more typically so)? -- And loving it, -Qu0ll (Rare, not extinct) _________________________________________________ Qu0llSixFour@gmail.com [Replace the "SixFour" with numbers to email me]
[toc] | [prev] | [next] | [standalone]
| From | lipska the kat <lipskathekat@example.com> |
|---|---|
| Date | 2014-04-27 11:43 +0100 |
| Message-ID | <qbudnW2L2OPxQsHOnZ2dnUVZ8l2dnZ2d@bt.com> |
| In reply to | #28251 |
On 27/04/14 10:53, Qu0ll wrote: > "lipska the kat" wrote in message > news:ptWdnfl58rD-JMHOnZ2dnUVZ8gUAAAAA@bt.com... > >> On 27/04/14 05:09, Roedy Green wrote: >>> Is there a word that means "class or interface"? >> >> Abstraction unit > > I have never heard it referred to like that. Couldn't an "abstraction > unit" be an entire group of classes/interfaces (and more typically so)? I'd call a group of abstraction units a component, a component may indeed be an abstraction at the higher level but it's built up of finer grained abstraction units. 'class' and 'interface' are just names given to abstraction units to enable us to talk about them. The name tells us what it is we are talking about (explicitly). It's quite a high level view I admit and can certainly be overloaded. > > -- > And loving it, > > -Qu0ll (Rare, not extinct) > _________________________________________________ > Qu0llSixFour@gmail.com > [Replace the "SixFour" with numbers to email me] -- lipska the kat - treacherous feline. Proudly nominated for IPOTY 2014 - LIGAF GNU/Linux user #560883 - linuxcounter.net
[toc] | [prev] | [next] | [standalone]
| From | Jeff Higgins <jeff@invalid.invalid> |
|---|---|
| Date | 2014-04-27 07:14 -0400 |
| Message-ID | <ljiot4$lnc$1@dont-email.me> |
| In reply to | #28242 |
On 04/27/2014 12:09 AM, Roedy Green wrote: > Is there a word that means "class or interface"? > mingle
[toc] | [prev] | [next] | [standalone]
| From | Jeff Higgins <jeff@invalid.invalid> |
|---|---|
| Date | 2014-04-27 07:32 -0400 |
| Message-ID | <ljiptl$vla$1@dont-email.me> |
| In reply to | #28242 |
On 04/27/2014 12:09 AM, Roedy Green wrote: > Is there a word that means "class or interface"? > ClassOrInterfaceType <http://docs.oracle.com/javase/specs/jls/se8/html/jls-4.html#jls-4.3>
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.java.programmer
csiph-web