Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news.ecp.fr!news.jacob-sparre.dk!loke.jacob-sparre.dk!news.thorslund.org!pnx.dk!border3.nntp.ams.giganews.com!backlog3.nntp.ams.giganews.com!Xl.tags.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!local2.nntp.ams.giganews.com!nntp.bt.com!news.bt.com.POSTED!not-for-mail NNTP-Posting-Date: Sun, 04 May 2014 06:58:55 -0500 From: "Chris Uppal" Newsgroups: comp.lang.java.programmer References: <8l0pl95jubrn24j0tgnqcc21arhkii83ko@4ax.com><535caadc$0$6712$9b4e6d93@newsspool2.arcor-online.net><535cda24$0$6715$9b4e6d93@newsspool2.arcor-online.net> Subject: Re: vocabulary Date: Sun, 4 May 2014 13:00:16 +0100 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5512 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5512 Message-ID: Lines: 41 X-Usenet-Provider: http://www.giganews.com X-AuthenticatedUsername: NoAuthUser X-Trace: sv3-37hGWOYJ45gobgzs/ikmQzVfB+e8JdwVbtP35f/oLgvqBkAuPGkpd2jK+63VnDZl/AL4+KV9bTiQhmQ!k0xsFsGRlxZDnfHMWFRyPfZxjtsceTaBe6nHf2e9Il6pptlYJ4mUTPBn5aTSWf/Z2jt+z5yK X-Complaints-To: abuse@btinternet.com X-DMCA-Complaints-To: abuse@btinternet.com X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 3242 Xref: csiph.com comp.lang.java.programmer:28362 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