Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #15033
| From | Arved Sandstrom <asandstrom3minus1@eastlink.ca> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: Holy boop: goto for Java |
| References | <jqh709$rgp$1@dont-email.me> <6AVyr.1859$8l2.827@newsfe14.iad> <jqha3s$95p$1@dont-email.me> <jqhcth$u5a$1@news.albasani.net> |
| Message-ID | <hsZyr.46128$Gm4.1924@newsfe01.iad> (permalink) |
| Organization | Public Usenet Newsgroup Access |
| Date | 2012-06-04 04:28 -0300 |
On 12-06-04 01:17 AM, Lew wrote: > markspace wrote: >> Daniel Pitts wrote: >>> Check the date of that article before getting to excited/disappointed >>> ;-) >> >> Ah. Somebody got me good, I think. > > In a highly limited, controlled and presumably > blessed-for-object-oriented way, Java does have a version of "goto", in > its 'break' and 'continue' statements. You can't just jump anywhere, but > you can jump to labels, with restrictions. > > I have never seen a use of Java's labeled 'break' or 'continue' outside > of tutorials and examples, though. > > The full, unbridled "goto" doesn't exist in Java except for the keyword > 'goto', whose head is mounted on a pike at the language's gates as a > warning. > I use labeled break/continue occasionally. I see a lot of advice on programming forums like StackOverflow that says never use them. Typical dogmatic advice is that you should extract inner-loop code into methods and use boolean return codes to make a top-level break/continue decision. What amazes me is that these individuals support this religious stance by arguing that it improves readability, when producing little auxiliary methods usually does anything but. The combination of conditions that would indicate a labeled break/continue is clear: 1. A loop; 2. A condition in that loop that could lead to a break or continue for it; 3. That condition is itself a loop. Furthermore, the logic in the loop is probably coupled to the logic in the rest of the main loop. To the degree that the logic in that inner loop makes (no) sense as a standalone method - size, understandability on its own etc - is the decision process I follow as to whether a labeled break/continue is advisable. In any case, Lew, I don't see that this has much to do with "blessed for OO". We're talking imperative coding here, which is what Java programmers spend the majority of their time doing. AHS -- Never interrupt your enemy when he is making a mistake. --Napoleon
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Holy boop: goto for Java markspace <-@.> - 2012-06-03 19:36 -0700
Re: Holy boop: goto for Java Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-06-03 20:03 -0700
Re: Holy boop: goto for Java markspace <-@.> - 2012-06-03 20:30 -0700
Re: Holy boop: goto for Java Lew <noone@lewscanon.com> - 2012-06-03 21:17 -0700
Re: Holy boop: goto for Java Robert Klemme <shortcutter@googlemail.com> - 2012-06-04 07:56 +0200
Re: Holy boop: goto for Java Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2012-06-04 04:28 -0300
Re: Holy boop: goto for Java Robert Klemme <shortcutter@googlemail.com> - 2012-06-04 00:37 -0700
Re: Holy boop: goto for Java Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-06-04 07:43 -0700
Re: Holy boop: goto for Java "Mike Schilling" <mscottschilling@hotmail.com> - 2012-06-04 07:47 -0700
Re: Holy boop: goto for Java "Mike Schilling" <mscottschilling@hotmail.com> - 2012-06-04 08:17 -0700
Re: Holy boop: goto for Java Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2012-06-04 17:07 -0300
Re: Holy boop: goto for Java Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-06-04 13:17 -0700
Re: Holy boop: goto for Java Gene Wirchenko <genew@ocis.net> - 2012-06-04 14:46 -0700
Re: Holy boop: goto for Java Robert Klemme <shortcutter@googlemail.com> - 2012-06-05 07:31 +0200
Re: Holy boop: goto for Java Gene Wirchenko <genew@ocis.net> - 2012-06-05 09:15 -0700
Re: Holy boop: goto for Java Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-06-05 10:51 -0700
Re: Holy boop: goto for Java Gene Wirchenko <genew@ocis.net> - 2012-06-05 10:54 -0700
Re: Holy boop: goto for Java Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2012-06-06 05:58 -0300
Re: Holy boop: goto for Java Lew <lewbloch@gmail.com> - 2012-06-06 12:11 -0700
Re: Holy boop: goto for Java Robert Klemme <shortcutter@googlemail.com> - 2012-06-05 23:24 +0200
Re: Holy boop: goto for Java Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-06-05 17:30 -0400
Re: Holy boop: goto for Java Gene Wirchenko <genew@ocis.net> - 2012-06-05 20:06 -0700
Re: Holy boop: goto for Java Patricia Shanahan <pats@acm.org> - 2012-07-22 06:37 -0700
Re: Holy boop: goto for Java Chris Riesbeck <Chris.Riesbeck@gmail.com> - 2012-07-23 13:27 -0500
Re: Holy boop: goto for Java Gene Wirchenko <genew@ocis.net> - 2012-07-23 13:23 -0700
Re: Holy boop: goto for Java Lew <lewbloch@gmail.com> - 2012-06-04 09:33 -0700
Re: Holy boop: goto for Java Joshua Cranmer <Pidgeot18@verizon.invalid> - 2012-06-04 07:26 -0400
Re: Holy boop: goto for Java "Mike Schilling" <mscottschilling@hotmail.com> - 2012-06-04 07:44 -0700
Re: Holy boop: goto for Java Robert Klemme <shortcutter@googlemail.com> - 2012-06-04 18:13 +0200
Re: Holy boop: goto for Java Gene Wirchenko <genew@ocis.net> - 2012-06-04 10:23 -0700
Re: Holy boop: goto for Java Lew <lewbloch@gmail.com> - 2012-06-04 10:45 -0700
Re: Holy boop: goto for Java Robert Klemme <shortcutter@googlemail.com> - 2012-06-04 20:31 +0200
Re: Holy boop: goto for Java Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-06-04 11:52 -0700
Re: Holy boop: goto for Java Leif Roar Moldskred <leifm@dimnakorr.com> - 2012-06-04 14:15 -0500
Re: Holy boop: goto for Java Lew <lewbloch@gmail.com> - 2012-06-04 14:52 -0700
Re: Holy boop: goto for Java Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-06-04 10:50 -0700
Re: Holy boop: goto for Java Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-06-04 10:56 -0700
Re: Holy boop: goto for Java Leif Roar Moldskred <leifm@dimnakorr.com> - 2012-06-04 13:05 -0500
Re: Holy boop: goto for Java Joshua Cranmer <Pidgeot18@verizon.invalid> - 2012-06-04 07:28 -0400
Re: Holy boop: goto for Java Roedy Green <see_website@mindprod.com.invalid> - 2012-06-03 22:10 -0700
csiph-web