Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!weretis.net!feeder1.news.weretis.net!news.albasani.net!.POSTED!not-for-mail From: Jan Burse Newsgroups: comp.lang.java.programmer Subject: Re: Style Police (a rant) Date: Mon, 29 Aug 2011 04:02:07 +0200 Organization: albasani.net Lines: 25 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> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: news.albasani.net z+ym8H4CLxa2uLD6EPlLNup5HHuf/5HUpar8ask5ylpvkfGrCMa9+PLuw7htCddksaQkg8+dd9rHuj6S6VMQWAQ88dyXiOzPu5KKJtA4R6sp34sgi5yQ+R68fAMA5+LI NNTP-Posting-Date: Mon, 29 Aug 2011 02:02:08 +0000 (UTC) Injection-Info: news.albasani.net; logging-data="QFx6CUQu4qjDUMU2B7QgM/0JaR/dBzvzu/sNwZzYGJnL7XkCYOi5FQwuyIwZ9Ubl3NjtdyHLipkzQe2WJD405gSsozOxDdFa3/1mIOdKjWg/Q6qcNNpSufQX8vejk2h2"; mail-complaints-to="abuse@albasani.net" User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:6.0) Gecko/20110820 Firefox/6.0 SeaMonkey/2.3.1 In-Reply-To: Cancel-Lock: sha1:uX49VjeahdqLyZGHbniZHc/1iNU= Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:7447 Lew schrieb: >> > 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 I don't think private methods are inherently final in the same sense that the final keyword works for non-private methods. private methods can be overshadowed. So it would be an illusion to make a method init() private and then expect that nobody can define init() as well in a subclass. But since private methods are compiled into a static method invocation instruction, there is no problem with this overshadowing. A private method can even be overshadowed with a public method, which is compiled into a dynamic method invocation instruction. Bye