Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #24802
| Path | csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsfeed.fsmpi.rwth-aachen.de!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Gene Wirchenko <genew@telus.net> |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: Interface with implied Constructor |
| Date | Mon, 22 Jul 2013 12:39:27 -0700 |
| Organization | A noiseless patient Spider |
| Lines | 82 |
| Message-ID | <852ru8909m1p1eqcnhpotjpbmv1dd5hmui@4ax.com> (permalink) |
| References | <krgpcp$pba$1@speranza.aioe.org> <925adeb1-65b5-4a50-86a8-4f04784f8da0@googlegroups.com> <kri3sj$lnl$1@speranza.aioe.org> <b4g0e8F35pjU1@mid.individual.net> <Qo1Gt.8876$2C2.1824@fx04.iad> <n45ju8laf3gcaqtlerq776rti1jtid53j9@4ax.com> <1KhGt.130731$7o1.74691@fx17.iad> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| Content-Transfer-Encoding | 7bit |
| Injection-Info | mx05.eternal-september.org; posting-host="60d0d39a542030f45c674d6e1df82370"; logging-data="6099"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18vGoom3U6tWr+zwt4eO8o2qCuK8q9tQaI=" |
| X-Newsreader | Forte Agent 4.2/32.1118 |
| Cancel-Lock | sha1:dMdO6hDCDv3K61Ra/jK9LvMka3M= |
| Xref | csiph.com comp.lang.java.programmer:24802 |
Show key headers only | View raw
On Fri, 19 Jul 2013 17:56:19 -0300, Arved Sandstrom
<asandstrom2@eastlink.ca> wrote:
>On 07/19/2013 04:38 PM, Gene Wirchenko wrote:
>> On Thu, 18 Jul 2013 23:21:35 -0300, Arved Sandstrom
>> <asandstrom2@eastlink.ca> wrote:
>>
>> [snip]
>>
>>> I'll be honest, Robert, personally I consider the behaviour of an object
>>> - the kinds of things you could specify in an interface - to be what the
>>> *initialized* object can (should) do.
>>
>> But there is more to it than that. There is also getting it
>> initialised. That should also be part of the API. I would not
>> enforce that it has to, but I sure would like the option to specify
>> constructor signatures in an interface.
>
>Apart from other problems with constructors in interfaces (e.g. a class
>implements 2 interfaces, both of which have constructors: which ctor do
>you ignore and hence violate a contract?), what do you intend to mandate
>by requiring a constructor with a given signature? That all implementing
>classes create matching private fields that are exposed by accessors?
>Why would you want to do that?
In that case, I would not have the constructor signature in the
interface.
What if I am not subclassing? Having the interface is then
documentation of the full API for the class.
>Although it's usually an anti-pattern, I believe a better idea would be
>to specify some important getters in an interface, if you need something
>like this. Rather than wanting to control how an object initializes
>itself and is implemented, typically what you're really after is to
>require that an object can provide some synthetic state information.
Why? I do not need any getters. I just want a prototype of the
constructor with the rest of the prototypes.
>>> I seriously dislike init() methods, not just in Java. Particularly if
>>> there is no sensible un-init()'ed object for the class. I just don't see
>>> any credible argument for them. Like Richard said, actually: "half-baked".
>>>
>>> Often the best way to properly initialize an object is to call a
>>> constructor with arguments. That's what they are for. And to be honest
>>> once again, a ctor *is* an implementation thing, IMO: it's not the
>>
>> A method is an implementation thing, too, but we have interface
>> specifications for them.
>
>The *body* of a method is implementation. Interface or no interface, the
>method as called, the way it represents to callers, is behaviour.
>
>I've seen people in threads make your argument. To call everything
>behaviour is not helpful. A constructor builds an object. I don't
>consider that behaviour.
What else could it be but behaviour? This definition for
behaviour is from dictionary.reference.com: "the action, reaction, or
functioning of a system, under normal or specified circumstances".
What is the behaviour of a constructor? It builds an object of type
_____. Redefining the word to suit your biases simply creates
confusion.
>>> business of an interface to dictate how an implementation will
>>> initialize objects that can support the interface contract. After all,
>>
>> That is exactly what it is for. How the implementation works is
>> not the business of the interface, but how to call it is.
>
>I don't consider a constructor a "call". Invoking a method on a properly
>initialized method, yes; *building* the object, no.
It is called, implicitly, but called nonetheless. Once again,
you are trying to redefine a commonly-used term to your biases.
[snip]
Sincerely,
Gene Wirchenko
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Interface with implied Constructor Richard Maher <maher_rjSPAMLESS@hotmail.com> - 2013-07-09 18:41 +0800
Re: Interface with implied Constructor Robert Klemme <shortcutter@googlemail.com> - 2013-07-09 04:08 -0700
Re: Interface with implied Constructor Richard Maher <maher_rjSPAMLESS@hotmail.com> - 2013-07-10 06:46 +0800
Re: Interface with implied Constructor Eric Sosman <esosman@comcast-dot-net.invalid> - 2013-07-09 21:08 -0400
Re: Interface with implied Constructor Kevin McMurtrie <mcmurtrie@pixelmemory.us> - 2013-07-11 19:11 -0700
Re: Interface with implied Constructor Robert Klemme <shortcutter@googlemail.com> - 2013-07-14 17:53 +0200
Re: Interface with implied Constructor Kevin McMurtrie <mcmurtrie@pixelmemory.us> - 2013-07-15 08:58 -0700
Re: Interface with implied Constructor Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2013-07-15 10:57 -0700
[OT] Re: Interface with implied Constructor Eric Sosman <esosman@comcast-dot-net.invalid> - 2013-07-15 14:13 -0400
Re: [OT] Re: Interface with implied Constructor Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2013-07-15 12:58 -0700
Re: Interface with implied Constructor Robert Klemme <shortcutter@googlemail.com> - 2013-07-15 20:45 +0200
Re: Interface with implied Constructor Robert Klemme <shortcutter@googlemail.com> - 2013-07-14 18:03 +0200
Re: Interface with implied Constructor Arved Sandstrom <asandstrom2@eastlink.ca> - 2013-07-18 23:21 -0300
Re: Interface with implied Constructor Gene Wirchenko <genew@telus.net> - 2013-07-19 12:38 -0700
Re: Interface with implied Constructor Arved Sandstrom <asandstrom2@eastlink.ca> - 2013-07-19 17:56 -0300
Re: Interface with implied Constructor Gene Wirchenko <genew@telus.net> - 2013-07-22 12:39 -0700
Re: Interface with implied Constructor Eric Sosman <esosman@comcast-dot-net.invalid> - 2013-07-22 16:02 -0400
Re: Interface with implied Constructor Arved Sandstrom <asandstrom2@eastlink.ca> - 2013-07-22 18:08 -0300
Re: Interface with implied Constructor Gene Wirchenko <genew@telus.net> - 2013-07-23 14:32 -0700
Re: Interface with implied Constructor Jim Gibson <jimsgibson@gmail.com> - 2013-07-23 14:43 -0700
Re: Interface with implied Constructor Gene Wirchenko <genew@telus.net> - 2013-07-24 13:27 -0700
Re: Interface with implied Constructor Arved Sandstrom <asandstrom2@eastlink.ca> - 2013-07-24 18:20 -0300
Re: Interface with implied Constructor Robert Klemme <shortcutter@googlemail.com> - 2013-07-26 00:03 +0200
Re: Interface with implied Constructor Martin Gregorie <martin@address-in-sig.invalid> - 2013-07-24 21:18 +0000
Re: Interface with implied Constructor Eric Sosman <esosman@comcast-dot-net.invalid> - 2013-07-24 17:42 -0400
Re: Interface with implied Constructor Eric Sosman <esosman@comcast-dot-net.invalid> - 2013-07-23 18:19 -0400
Re: Interface with implied Constructor Gene Wirchenko <genew@telus.net> - 2013-07-24 13:31 -0700
Re: Interface with implied Constructor Steven Simpson <ss@domain.invalid> - 2013-07-27 04:06 +0100
Re: Interface with implied Constructor Martin Gregorie <martin@address-in-sig.invalid> - 2013-07-19 21:21 +0000
Re: Interface with implied Constructor Arved Sandstrom <asandstrom2@eastlink.ca> - 2013-07-19 18:56 -0300
Re: Interface with implied Constructor Eric Sosman <esosman@comcast-dot-net.invalid> - 2013-07-19 18:10 -0400
Re: Interface with implied Constructor Arved Sandstrom <asandstrom2@eastlink.ca> - 2013-07-19 20:46 -0300
Re: Interface with implied Constructor Richard Maher <maher_rjSPAMLESS@hotmail.com> - 2013-07-20 12:42 +0800
Re: Interface with implied Constructor Arved Sandstrom <asandstrom2@eastlink.ca> - 2013-07-20 09:08 -0300
Re: Interface with implied Constructor Eric Sosman <esosman@comcast-dot-net.invalid> - 2013-07-20 09:08 -0400
Re: Interface with implied Constructor Kevin McMurtrie <mcmurtrie@pixelmemory.us> - 2013-07-19 19:20 -0700
Re: Interface with implied Constructor markspace <markspace@nospam.nospam> - 2013-07-19 20:11 -0700
Re: Interface with implied Constructor Richard Maher <maher_rjSPAMLESS@hotmail.com> - 2013-07-20 12:26 +0800
Re: Interface with implied Constructor Arved Sandstrom <asandstrom2@eastlink.ca> - 2013-07-20 09:38 -0300
Re: Interface with implied Constructor Robert Klemme <shortcutter@googlemail.com> - 2013-07-20 19:46 +0200
Re: Interface with implied Constructor Martin Gregorie <martin@address-in-sig.invalid> - 2013-07-20 19:12 +0000
Re: Interface with implied Constructor Eric Sosman <esosman@comcast-dot-net.invalid> - 2013-07-20 17:12 -0400
Re: Interface with implied Constructor Martin Gregorie <martin@address-in-sig.invalid> - 2013-07-20 21:18 +0000
Re: Interface with implied Constructor Robert Klemme <shortcutter@googlemail.com> - 2013-07-21 12:13 +0200
Re: Interface with implied Constructor Arved Sandstrom <asandstrom2@eastlink.ca> - 2013-07-21 16:18 -0300
Re: Interface with implied Constructor markspace <markspace@nospam.nospam> - 2013-07-21 13:45 -0700
Re: Interface with implied Constructor Eric Sosman <esosman@comcast-dot-net.invalid> - 2013-07-21 16:58 -0400
Re: Interface with implied Constructor Arved Sandstrom <asandstrom2@eastlink.ca> - 2013-07-21 21:19 -0300
Re: Interface with implied Constructor Robert Klemme <shortcutter@googlemail.com> - 2013-07-20 20:09 +0200
Re: Interface with implied Constructor Robert Klemme <shortcutter@googlemail.com> - 2013-07-20 20:21 +0200
Re: Interface with implied Constructor Joerg Meier <joergmmeier@arcor.de> - 2013-07-20 23:17 +0200
Re: Interface with implied Constructor Eric Sosman <esosman@comcast-dot-net.invalid> - 2013-07-20 17:32 -0400
Re: Interface with implied Constructor Joerg Meier <joergmmeier@arcor.de> - 2013-07-21 00:10 +0200
Re: Interface with implied Constructor Arved Sandstrom <asandstrom2@eastlink.ca> - 2013-07-21 17:53 -0300
Re: Interface with implied Constructor markspace <markspace@nospam.nospam> - 2013-07-09 18:13 -0700
Re: Interface with implied Constructor Richard Maher <maher_rjSPAMLESS@hotmail.com> - 2013-07-10 18:03 +0800
Re: Interface with implied Constructor markspace <markspace@nospam.nospam> - 2013-07-10 08:41 -0700
Re: Interface with implied Constructor Richard Maher <maher_rjSPAMLESS@hotmail.com> - 2013-07-11 06:53 +0800
Re: Interface with implied Constructor Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2013-07-09 21:41 -0700
Re: Interface with implied Constructor Richard Maher <maher_rjSPAMLESS@hotmail.com> - 2013-07-10 17:55 +0800
Re: Interface with implied Constructor Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2013-07-10 14:52 -0700
Re: Interface with implied Constructor Roedy Green <see_website@mindprod.com.invalid> - 2013-07-10 16:02 -0700
csiph-web