Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.datemas.de!rt.uk.eu.org!aioe.org!.POSTED!not-for-mail From: Richard Maher Newsgroups: comp.lang.java.programmer Subject: Re: Interface with implied Constructor Date: Wed, 10 Jul 2013 06:46:40 +0800 Organization: Aioe.org NNTP Server Lines: 22 Message-ID: References: <925adeb1-65b5-4a50-86a8-4f04784f8da0@googlegroups.com> NNTP-Posting-Host: jOhPn0KFjrxwuMc9OPMmCw.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:17.0) Gecko/20130620 Thunderbird/17.0.7 X-Notice: Filtered by postfilter v. 0.8.2 Xref: csiph.com comp.lang.java.programmer:24718 On 7/9/2013 7:08 PM, Robert Klemme wrote: > Why do you want to do that? > For me it's personal preference, but for some technical rationale: - If you don't provide sufficient information to the constructor: 1) You get half-baked objects 2) Every real (non-init()) method now has to check "Has init() run? Am I complete?" 3) If using setters, how do you enforce that they are called in the correct order? Most importantly, Why the hell do you think Java (and all other OO languages) support arguments to constructors and overloading in the first place??? Do you think the authors have been wasting their time or providing redundant technology all these years? So let me ask you "Why do you want to use setters or an init() method?" Cheers Richard Maher