Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!nx02.iad01.newshosting.com!newshosting.com!news-out.readnews.com!news-xxxfer.readnews.com!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail From: Lew Newsgroups: comp.lang.java.programmer Subject: Re: Style Police (a rant) Date: Sun, 28 Aug 2011 13:09:52 -0700 (PDT) Organization: http://groups.google.com Lines: 33 Message-ID: References: <36f4953c-f085-4850-85eb-bb248a8cf1bb@glegroupsg2000goo.googlegroups.com> <252cd91f-0695-4cda-8ba0-70cfbc5fbd7a@glegroupsg2000goo.googlegroups.com> <78817664-363f-4e73-99e5-ef3c0a3566af@glegroupsg2000goo.googlegroups.com> Reply-To: comp.lang.java.programmer@googlegroups.com NNTP-Posting-Host: 216.239.45.130 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: posting.google.com 1314562297 22807 127.0.0.1 (28 Aug 2011 20:11:37 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Sun, 28 Aug 2011 20:11:37 +0000 (UTC) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=216.239.45.130; posting-account=CP-lKQoAAAAGtB5diOuGlDQk0jIwmH0T User-Agent: G2/1.0 X-Google-Web-Client: true Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:7440 On Sunday, August 28, 2011 6:32:37 AM UTC-7, Jan Burse wrote: > Lew schrieb: > > Given that calling non-final methods from a constructor is a > > very well-known antipattern, it's a bit like asking, ... > > I didn't know that this is an anti pattern. A solution > could be also to make the method private. A well known antipattern, and private methods are inherently final. (So are static methods.) http://www.javapractices.com/topic/TopicAction.do?Id=215 Even more cautions about constructor, such as not to start a thread within one or let 'this' escape: http://www.javapractices.com/topic/TopicAction.do?Id=11 and on overridable methods: http://www.javapractices.com/topic/TopicAction.do?Id=89 More on overridable methods from constructors: in particular _et seq._ More on "practice safe construction" and the general antipattern of putting code in a constructor at all: From this last link, a warning against using ignorance as an excuse: "When I asked why they were doing this they stated that they did it all the time. Then I explained how this is typically a good habit to have they defended themselves with 'Nobody told me'." -- Lew