Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #11361
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!.POSTED!not-for-mail |
|---|---|
| From | Lew <noone@lewscanon.com> |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: Blocks for scope control |
| Date | Sun, 15 Jan 2012 11:28:38 -0800 |
| Organization | albasani.net |
| Lines | 67 |
| Message-ID | <jev9d7$nkb$1@news.albasani.net> (permalink) |
| References | <dBCQq.122$d%2.16@newsfe07.iad> <jev431$v4i$1@dont-email.me> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Trace | news.albasani.net KUcHPrVV6S2dRTZailNkFgT6Q8zl9h0iYD2vdvXURtcqHIsXaKkODQkcmIZuj+1a7gKygnT/VARt/nKrWcsyNp6Qrj/3qICnCTA8zooJN5duu7x7y01PixkXvOBW6KD8 |
| NNTP-Posting-Date | Sun, 15 Jan 2012 19:28:40 +0000 (UTC) |
| Injection-Info | news.albasani.net; logging-data="7wWsn92jy8aJQjoQIZ2LvJZOChpPGVR01FThTgFJgoDvhEZS76I8UFRcJzAkOY+8RGoXYdwO+so3obqNporUWs5t270grqsf6kQfiYz85Bq0B/MaoZQ7Oq878wOlleea"; mail-complaints-to="abuse@albasani.net" |
| User-Agent | Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.24) Gecko/20111109 Thunderbird/3.1.16 |
| In-Reply-To | <jev431$v4i$1@dont-email.me> |
| Cancel-Lock | sha1:n4Y5tIWrB2NNbAFnoP4g9SSP0vo= |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:11361 |
Show key headers only | View raw
On 01/15/2012 09:57 AM, markspace wrote:
> On 1/15/2012 7:50 AM, Arved Sandstrom wrote:
>
>> I almost never see anyone else using these things this way.
>
>
> IMO, I dislike spurious and overused indentation in code, so that's likely why
> I shy away from "extra" use of braces.
>
> for( ...some code )
> {
> do some init
> {
> do a little work
> {
> declare a temporary variable
> }
> {
> declare another temporary variable
> }
> {
> declare yet another temporary variable
> }
> {
> declare still yet another temporary variable
> {
> declare a temporary variable inside
> an anonymous block
> }
> }
> }
> }
>
> vs. just one level of indentation, I believe I'd greatly prefer the latter,
> especially in the long run. And the above is with 3-4 spaces for indenting,
> imagine what it would look like with 8.
Since eight-space indentation violates the Java coding conventions it doesn't
deserve consideration. Code that indents eight spaces should be rejected in
code review and brought into compliance.
<http://www.oracle.com/technetwork/java/codeconventions-136091.html#262>
But your larger point is valid, and you can just do this:
for( ...some code )
{
do some init
do a little work
declare a temporary variable
declare another temporary variable
declare yet another temporary variable
declare still yet another temporary variable
declare a temporary variable inside
}
The reason to go with the supposedly "extra" braces is to guarantee that a
temporary variable is not re-used, but if a method is so long that that's a
risk there's a good chance that it's too long.
And again I say, "anonymous block" makes no sense because blocks aren't named
in the first place.
--
Lew
Honi soit qui mal y pense.
http://upload.wikimedia.org/wikipedia/commons/c/cf/Friz.jpg
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Blocks for scope control Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2012-01-15 11:50 -0400
Re: Blocks for scope control Robert Klemme <shortcutter@googlemail.com> - 2012-01-15 17:10 +0100
Re: Blocks for scope control Robert Klemme <shortcutter@googlemail.com> - 2012-01-15 17:32 +0100
Re: Blocks for scope control Lew <noone@lewscanon.com> - 2012-01-15 11:21 -0800
Re: Blocks for scope control Robert Klemme <shortcutter@googlemail.com> - 2012-01-16 07:59 +0100
Re: Blocks for scope control markspace <-@.> - 2012-01-15 09:57 -0800
Re: Blocks for scope control Lew <noone@lewscanon.com> - 2012-01-15 11:28 -0800
Re: Blocks for scope control Lew <noone@lewscanon.com> - 2012-01-15 11:00 -0800
Re: Blocks for scope control Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2012-01-15 17:49 -0400
Re: Blocks for scope control Lew <noone@lewscanon.com> - 2012-01-15 15:45 -0800
Re: Blocks for scope control Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2012-01-19 21:54 -0400
Re: Blocks for scope control Robert Klemme <shortcutter@googlemail.com> - 2012-01-20 08:41 +0100
Re: Blocks for scope control Lew <noone@lewscanon.com> - 2012-01-20 15:24 -0800
Re: Blocks for scope control Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2012-01-20 19:30 -0400
Re: Blocks for scope control Lew <noone@lewscanon.com> - 2012-01-20 15:54 -0800
Re: Blocks for scope control Robert Klemme <shortcutter@googlemail.com> - 2012-01-16 07:55 +0100
Re: Blocks for scope control Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2012-01-19 21:16 -0400
Re: Blocks for scope control Robert Klemme <shortcutter@googlemail.com> - 2012-01-21 13:25 +0100
Re: Blocks for scope control Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2012-01-21 10:41 -0400
Re: Blocks for scope control Robert Klemme <shortcutter@googlemail.com> - 2012-01-22 13:03 +0100
Re: Blocks for scope control Roedy Green <see_website@mindprod.com.invalid> - 2012-01-16 06:09 -0800
Re: Blocks for scope control Henk van Voorthuijsen <voorth@xs4all.nl> - 2012-01-16 07:03 -0800
Re: Blocks for scope control Arne Vajhøj <arne@vajhoej.dk> - 2012-01-17 18:43 -0500
Re: Blocks for scope control Lew <noone@lewscanon.com> - 2012-01-20 11:05 -0800
Re: Blocks for scope control Gene Wirchenko <genew@ocis.net> - 2012-01-20 12:11 -0800
Re: Blocks for scope control Arne Vajhøj <arne@vajhoej.dk> - 2012-02-06 21:24 -0500
csiph-web