Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Robert Klemme Newsgroups: comp.lang.java.programmer Subject: Re: Blocks for scope control Date: Sun, 15 Jan 2012 17:32:26 +0100 Lines: 33 Message-ID: <9ngdd9Fv6mU1@mid.individual.net> References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable X-Trace: individual.net DHxHUqubbB+FvFyEMPuXpgyLW2V8y8yyNZKNaoZDgdLJw8XB0= Cancel-Lock: sha1:pCW5CEMLuOHn72Vg4tW6Rhj0E/E= User-Agent: Mozilla/5.0 (Windows NT 6.0; WOW64; rv:9.0) Gecko/20111222 Thunderbird/9.0.1 In-Reply-To: Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:11348 On 15.01.2012 17:18, Stefan Ram wrote: > Arved Sandstrom writes: >> Any thoughts? > > Im using this whenever it makes sense. For example, > say you wanted to add a button: > > { final Button button =3D new Button(); frame.add( button ); } Why do you think it makes sense to replace this frame.add( new Button() ); with the block above? If initialization is more complex, I'd rather do t= his frame.add( createButton() ); than > or apply the refactor =BBextract method=AB: > > void m( final Frame frame ) > { final Button button =3D new Button(); frame.add( button ); } Cheers robert --=20 remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/