Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #7405 > unrolled thread

Style Police (a rant)

Started byEric Sosman <esosman@ieee-dot-org.invalid>
First post2011-08-26 20:56 -0400
Last post2011-08-31 00:31 +0200
Articles 20 on this page of 182 — 33 participants

Back to article view | Back to comp.lang.java.programmer


Contents

  Style Police (a rant) Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-08-26 20:56 -0400
    Re: Style Police (a rant) Robert Klemme <shortcutter@googlemail.com> - 2011-08-27 09:58 +0200
    Re: Style Police (a rant) Rajiv Gupta <rajiv@invalid.com> - 2011-08-27 18:02 +1000
      Re: Style Police (a rant) v_borchert@despammed.com (Volker Borchert) - 2011-08-27 08:40 +0000
    Re: Style Police (a rant) Jan Burse <janburse@fastmail.fm> - 2011-08-27 13:27 +0200
      Re: Style Police (a rant) Jan Burse <janburse@fastmail.fm> - 2011-08-27 13:33 +0200
        Re: Style Police (a rant) Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-08-27 11:08 -0400
        Re: Style Police (a rant) Lew <lewbloch@gmail.com> - 2011-08-27 08:34 -0700
          Re: Style Police (a rant) Lew <lewbloch@gmail.com> - 2011-08-27 08:37 -0700
          Re: Style Police (a rant) Jan Burse <janburse@fastmail.fm> - 2011-08-27 17:59 +0200
            Re: Style Police (a rant) Jan Burse <janburse@fastmail.fm> - 2011-08-27 18:06 +0200
              Re: Style Police (a rant) Jan Burse <janburse@fastmail.fm> - 2011-08-27 18:08 +0200
              Re: Style Police (a rant) Lew <lewbloch@gmail.com> - 2011-08-27 09:50 -0700
                Re: Style Police (a rant) Jan Burse <janburse@fastmail.fm> - 2011-08-27 19:15 +0200
                  Re: Style Police (a rant) Lew <lewbloch@gmail.com> - 2011-08-27 13:09 -0700
                    Re: Style Police (a rant) Jan Burse <janburse@fastmail.fm> - 2011-08-27 23:18 +0200
                      Re: Style Police (a rant) Lew <lewbloch@gmail.com> - 2011-08-27 16:10 -0700
                        Re: Style Police (a rant) Jan Burse <janburse@fastmail.fm> - 2011-08-28 01:59 +0200
                          Re: Style Police (a rant) Lew <lewbloch@gmail.com> - 2011-08-27 18:59 -0700
                            Re: Style Police (a rant) Jan Burse <janburse@fastmail.fm> - 2011-08-28 15:32 +0200
                              Re: Style Police (a rant) Lew <lewbloch@gmail.com> - 2011-08-28 13:09 -0700
                                Re: Style Police (a rant) Jan Burse <janburse@fastmail.fm> - 2011-08-29 04:02 +0200
                                  Re: Style Police (a rant) Lew <lewbloch@gmail.com> - 2011-08-28 19:20 -0700
                                    Re: Style Police (a rant) Jan Burse <janburse@fastmail.fm> - 2011-08-29 09:44 +0200
                                      Re: Style Police (a rant) Lew <lewbloch@gmail.com> - 2011-08-29 08:30 -0700
                                        Re: Style Police (a rant) Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2011-08-29 16:37 +0000
                                          Re: Style Police (a rant) Lew <lewbloch@gmail.com> - 2011-08-29 12:10 -0700
                                      Re: Style Police (a rant) Robert Klemme <shortcutter@googlemail.com> - 2011-08-29 18:21 +0200
                                Re: Style Police (a rant) Jan Burse <janburse@fastmail.fm> - 2011-08-29 04:06 +0200
      Re: Style Police (a rant) Wanja Gayk <brixomatic@yahoo.com> - 2011-09-10 06:45 +0200
        Re: Style Police (a rant) Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2011-09-10 11:40 +0000
          Re: Style Police (a rant) Lew <lewbloch@gmail.com> - 2011-09-10 14:06 -0700
            Re: Style Police (a rant) Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2011-09-11 14:07 +0000
              Re: Style Police (a rant) Arne Vajhøj <arne@vajhoej.dk> - 2011-09-11 10:55 -0400
                Re: Style Police (a rant) Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2011-09-11 23:34 +0000
              Re: Style Police (a rant) Arne Vajhøj <arne@vajhoej.dk> - 2011-09-11 10:58 -0400
                Re: Style Police (a rant) Patricia Shanahan <pats@acm.org> - 2011-09-11 10:12 -0700
                Re: Style Police (a rant) Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2011-09-14 12:22 +0000
                Re: Style Police (a rant) Bent C Dalager <bcd@pvv.ntnu.no> - 2011-09-14 15:04 +0000
                  Re: Style Police (a rant) Paul Cager <paul.cager@googlemail.com> - 2011-09-14 09:36 -0700
              Re: Style Police (a rant) Lew <lewbloch@gmail.com> - 2011-09-11 09:47 -0700
                Re: Style Police (a rant) Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2011-09-11 23:32 +0000
                  Re: Style Police (a rant) Wanja Gayk <brixomatic@yahoo.com> - 2011-09-17 00:57 +0200
                    Re: Style Police (a rant) Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2011-09-17 19:56 +0000
              Re: Style Police (a rant) Wanja Gayk <brixomatic@yahoo.com> - 2011-09-11 21:20 +0200
                Re: Style Police (a rant) Cthun <cthun_117@qmail.net.au> - 2011-09-11 17:11 -0400
                  Re: Style Police (a rant) Wanja Gayk <brixomatic@yahoo.com> - 2011-09-12 01:22 +0200
                    Re: Style Police (a rant) Arne Vajhøj <arne@vajhoej.dk> - 2011-09-11 21:13 -0400
                  Re: Style Police (a rant) Retahiv Oopsiscame <roopsisc@gmail.com> - 2011-09-11 16:54 -0700
                    Re: Style Police (a rant) Cthun <cthun_117@qmail.net.au> - 2011-09-11 23:42 -0400
                      Re: Style Police (a rant) Retahiv Oopsiscame <roopsisc@gmail.com> - 2011-09-12 21:54 -0700
                        Re: Style Police (a rant) "Cthun" <cthun_117@qmail.net.au> - 2011-09-13 07:18 -0400
                          Re: Style Police (a rant) Cthun <cthun_117@qmail.net.au> - 2011-09-13 10:07 -0400
                            Re: Style Police (a rant) Lew <lewbloch@gmail.com> - 2011-09-13 08:15 -0700
                              Re: Style Police (a rant) Cthun <cthun_117@qmail.net.au> - 2011-09-13 12:00 -0400
                        Re: Style Police (a rant) Cthun <cthun_117@qmail.net.au> - 2011-09-13 10:10 -0400
                          Re: Style Police (a rant) Retahiv Oopsiscame <roopsisc@gmail.com> - 2011-09-13 09:55 -0700
                            Re: Style Police (a rant) Cthun <cthun_117@qmail.net.au> - 2011-09-15 10:37 -0400
                              Re: Style Police (a rant) "Cthun" <cthun_9112011@qmail.net.au> - 2011-09-15 22:58 -0400
                                Murphy = Troll [DO NOT FEED] thoolen <th00len@th0lenbot.thorium> - 2011-09-16 00:23 -0400
                              Re: Style Police (a rant) Retahiv Oopsiscame <roopsisc@gmail.com> - 2011-09-16 03:26 -0700
                                Re: Style Police (a rant) un-Bent <dob@dib.dib.null> - 2011-09-16 13:02 +0000
                                  Murphy = Troll [DO NOT FEED] thoolen <th00len@th0lenbot.thorium> - 2011-09-16 22:40 -0400
                                Re: Style Police (a rant) Cthun <cthun_117@qmail.net.au> - 2011-09-17 19:36 -0400
                                  Re: Style Police (a rant) "kaffel'latte" <jiggingjava@qmail.net> - 2011-09-19 08:58 -0400
                                    Re: Style Police (a rant) thoolen <th00len@th0lenbot.thorium> - 2011-09-19 11:56 -0400
                                      Re: Style Police (a rant) "kaffel'latte" <jiggingjava@qmail.net> - 2011-09-19 17:05 -0400
                                        Re: Style Police (a rant) thoolen <th00len@th0lenbot.thorium> - 2011-09-19 19:13 -0400
                                          Re: Style Police (a rant) k00k Derbyshire spins freely "kaffel'latte" <jiggingjava@qmail.net> - 2011-09-19 20:45 -0400
                                            Re: Style Police (a rant) k00k Derbyshire spins freely thoolen <th00len@th0lenbot.thorium> - 2011-09-21 18:37 -0400
                                  Re: Style Police (a rant) Retahiv Oopsiscame <roopsisc@gmail.com> - 2011-09-26 15:13 -0700
                                    Re: Style Police (a rant) Cthun <cthun_117@qmail.net.au> - 2011-09-26 19:34 -0400
                                      Re: Style Police (a rant) Retahiv Oopsiscame <roopsisc@gmail.com> - 2011-10-01 06:49 -0700
                                        Re: Style Police (a rant) Lew <lewbloch@gmail.com> - 2011-10-01 09:21 -0700
                                          Re: Style Police (a rant) Cthun <cthun_117@qmail.net.au> - 2011-10-01 14:17 -0400
                                            Re: Style Police (a rant) Wanja Gayk <brixomatic@yahoo.com> - 2011-10-01 20:53 +0200
                                              Re: Style Police (a rant) Cthun <cthun_117@qmail.net.au> - 2011-10-01 21:12 -0400
                                          Re: Style Police (a rant) Retahiv Oopsiscame <roopsisc@gmail.com> - 2011-10-05 06:17 -0700
                    Re: Style Police (a rant) "Cthun" <cthun_117@qmail.net.au> - 2011-09-12 04:56 -0400
                      Re: Style Police (a rant) Cthun <cthun_117@qmail.net.au> - 2011-09-12 05:12 -0400
                    Re: Style Police (a rant) "Cthun" <cthun_117@qmail.net.au> - 2011-09-12 04:59 -0400
                      Re: Style Police (a rant) Cthun <cthun_117@qmail.net.au> - 2011-09-12 05:13 -0400
                Re: Style Police (a rant) Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2011-09-11 23:17 +0000
                  Re: Style Police (a rant) Arne Vajhøj <arne@vajhoej.dk> - 2011-09-11 21:12 -0400
                  Re: Style Police (a rant) Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2011-09-12 07:36 -0300
                Re: Style Police (a rant) "Cthun" <cthun_117@qmail.net.au> - 2011-09-12 04:58 -0400
                  Re: Style Police (a rant) Cthun <cthun_117@qmail.net.au> - 2011-09-12 05:12 -0400
          Re: Style Police (a rant) Wanja Gayk <brixomatic@yahoo.com> - 2011-09-11 15:33 +0200
            Re: Style Police (a rant) Lew <lewbloch@gmail.com> - 2011-09-11 09:42 -0700
              Re: Style Police (a rant) Lars Enderin <lars.enderin@telia.com> - 2011-09-11 20:35 +0200
                Re: Style Police (a rant) Retahiv Oopsiscame <roopsisc@gmail.com> - 2011-09-11 16:55 -0700
                  Re: Style Police (a rant) Lew <lewbloch@gmail.com> - 2011-09-11 20:36 -0700
                    Re: Style Police (a rant) Lars Enderin <lars.enderin@telia.com> - 2011-09-12 10:05 +0200
                      Re: Style Police (a rant) Lew <lewbloch@gmail.com> - 2011-09-12 15:35 -0700
                        Re: Style Police (a rant) Lars Enderin <lars.enderin@telia.com> - 2011-09-13 10:35 +0200
                          Re: Style Police (a rant) Retahiv Oopsiscame <roopsisc@gmail.com> - 2011-09-13 09:48 -0700
                            Re: Style Police (a rant) Lew <lewbloch@gmail.com> - 2011-09-13 12:18 -0700
                              Re: Style Police (a rant) Retahiv Oopsiscame <roopsisc@gmail.com> - 2011-09-13 17:30 -0700
                      Re: Style Police (a rant) Retahiv Oopsiscame <roopsisc@gmail.com> - 2011-09-12 21:59 -0700
                        Re: Style Police (a rant) Joe Attardi <jattardi@gmail.com> - 2011-09-23 10:54 -0700
                          Re: Style Police (a rant) thoolen <th00len@th0lenbot.thorium> - 2011-09-24 01:54 -0400
                            Re: Style Police (a rant) "tholen@antispam.ham" <tholen@ifa.hawaii.edu> - 2011-09-24 02:58 -0700
                              Re: Style Police (a rant) thoolen <th00len@th0lenbot.thorium> - 2011-09-24 11:35 -0400
                            Re: Style Police (a rant) Joe Attardi <jattardi@gmail.com> - 2011-09-26 13:50 -0700
                              Re: Style Police (a rant) Jane Doe <jdoe@love.in.d.jungle.invalid> - 2011-09-26 21:14 +0000
                                Re: Style Police (a rant) thoolen <th00len@th0lenbot.thorium> - 2011-09-26 17:50 -0400
                                  Re: Style Police (a rant) "tholen@antispam.ham" <tholen@ifa.hawaii.edu> - 2011-11-04 15:56 -0700
                                    Re: Style Police (a rant) thoolen <th00len@th0lenbot.thorium> - 2011-11-07 12:04 -0500
                                      Re: Style Police (a rant) "tholen@antispam.ham" <tholen@ifa.hawaii.edu> - 2011-11-10 15:22 -0800
                              Re: Style Police (a rant) thoolen <th00len@th0lenbot.thorium> - 2011-09-26 17:47 -0400
                              Re: Style Police (a rant) "tholen@antispam.ham" <tholen@ifa.hawaii.edu> - 2011-11-04 15:48 -0700
                                Re: Style Police (a rant) dizzy <dizzy@nospam.invalid> - 2011-11-05 07:58 -0500
                                  Re: Style Police (a rant) "tholen@antispam.ham" <tholen@ifa.hawaii.edu> - 2011-11-10 15:17 -0800
                          Re: Style Police (a rant) Retahiv Oopsiscame <roopsisc@gmail.com> - 2011-09-26 15:17 -0700
                            Re: Style Police (a rant) Jane Doe <jdoe@love.in.d.jungle.invalid> - 2011-09-27 00:50 +0000
                              Re: Style Police (a rant) tisue@cs.nwu.edu (Seth Tisue) - 2011-09-27 08:55 -0600
                                Re: Style Police (a rant) thoolen <th00len@th0lenbot.thorium> - 2011-09-27 14:14 -0400
                              Re: Style Police (a rant) thoolen <th00len@th0lenbot.thorium> - 2011-09-27 14:11 -0400
                              Re: Style Police (a rant) Retahiv Oopsiscame <roopsisc@gmail.com> - 2011-10-01 07:31 -0700
                            Re: Style Police (a rant) thoolen <th00len@th0lenbot.thorium> - 2011-09-26 22:24 -0400
                              Re: Style Police (a rant) Jane Doe <jdoe@love.in.d.jungle.invalid> - 2011-09-27 09:30 +0000
                                Re: Style Police (a rant) tisue@cs.nwu.edu (Seth Tisue) - 2011-09-27 08:57 -0600
                                  Re: Style Police (a rant) thoolen <th00len@th0lenbot.thorium> - 2011-09-27 14:38 -0400
                                Re: Style Police (a rant) thoolen <th00len@th0lenbot.thorium> - 2011-09-27 14:36 -0400
                            Re: Style Police (a rant) Kaz Kylheku <kaz@kylheku.com> - 2011-09-30 15:58 +0000
                              Re: Style Police (a rant) Retahiv Oopsiscame <roopsisc@gmail.com> - 2011-10-01 07:32 -0700
                            Re: Style Police (a rant) Arne Vajhøj <arne@vajhoej.dk> - 2011-09-30 21:26 -0400
                              Re: Style Police (a rant) Retahiv Oopsiscame <roopsisc@gmail.com> - 2011-10-01 07:34 -0700
                                Re: Style Police (a rant) Arne Vajhøj <arne@vajhoej.dk> - 2011-10-01 15:51 -0400
                                  Re: Style Police (a rant) Retahiv Oopsiscame <roopsisc@gmail.com> - 2011-10-05 06:18 -0700
                                Re: Style Police (a rant) "Cthun" <cthun_117@qmail.net.au> - 2011-10-01 16:26 -0400
                                  Re: Style Police (a rant) thoolen <th00len@th0lenbot.thorium> - 2011-10-01 21:25 -0400
                                  Re: Style Police (a rant) Retahiv Oopsiscame <roopsisc@gmail.com> - 2011-10-05 06:23 -0700
                                    Re: Style Police (a rant) Cthun <cthun_117@qmail.net.au> - 2011-10-05 10:01 -0400
                                      Re: Style Police (a rant) Retahiv Oopsiscame <roopsisc@gmail.com> - 2011-10-07 08:29 -0700
                                        Re: Style Police (a rant) Cthun <cthun_117@qmail.net.au> - 2011-10-07 17:34 -0400
                    Re: Style Police (a rant) Retahiv Oopsiscame <roopsisc@gmail.com> - 2011-09-12 21:58 -0700
                  Re: Style Police (a rant) "Cthun" <cthun_117@qmail.net.au> - 2011-09-12 04:52 -0400
                    Re: Style Police (a rant) Cthun <cthun_117@qmail.net.au> - 2011-09-12 05:14 -0400
                      Re: Style Police (a rant) "Cthun" <cthun_117@qmail.net.au> - 2011-09-12 06:42 -0400
                        Re: Style Police (a rant) Cthun <cthun_117@qmail.net.au> - 2011-09-12 07:20 -0400
                          Re: Style Police (a rant) "Cthun" <cthun_117@qmail.net.au> - 2011-09-12 08:46 -0400
                            Re: Style Police (a rant) thoolen <th00len@th0lenbot.thorium> - 2011-09-12 21:03 -0400
                Re: Style Police (a rant) Tom Anderson <twic@urchin.earth.li> - 2011-09-12 20:18 +0100
              Re: Style Police (a rant) Wanja Gayk <brixomatic@yahoo.com> - 2011-09-11 21:20 +0200
                Re: Style Police (a rant) Lew <lewbloch@gmail.com> - 2011-09-11 13:52 -0700
            Re: Style Police (a rant) Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2011-09-12 00:17 +0000
        Re: Style Police (a rant) Arne Vajhøj <arne@vajhoej.dk> - 2011-09-10 21:32 -0400
          Re: Style Police (a rant) Wanja Gayk <brixomatic@yahoo.com> - 2011-09-11 13:27 +0200
            Re: Style Police (a rant) Arne Vajhøj <arne@vajhoej.dk> - 2011-09-11 11:05 -0400
          Re: Style Police (a rant) Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2011-09-11 13:23 +0000
            Re: Style Police (a rant) Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-09-11 10:04 -0400
              Re: Style Police (a rant) Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2011-09-11 12:45 -0300
                Re: Style Police (a rant) Arne Vajhøj <arne@vajhoej.dk> - 2011-09-11 16:53 -0400
                  Re: Style Police (a rant) Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2011-09-14 12:30 +0000
                    Re: Style Police (a rant) Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-09-14 20:47 -0400
                      Re: Style Police (a rant) Lew <lewbloch@gmail.com> - 2011-09-14 18:06 -0700
                      Re: Style Police (a rant) Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2011-09-15 10:06 +0000
                      Re: Style Police (a rant) blmblm@myrealbox.com <blmblm.myrealbox@gmail.com> - 2011-09-20 11:28 +0000
                        Re: Style Police (a rant) Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-09-20 07:36 -0400
                          Re: Style Police (a rant) Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2011-09-20 13:04 +0000
                        Re: Style Police (a rant) Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2011-09-20 20:34 -0300
                    Re: Style Police (a rant) Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2011-09-14 22:33 -0300
                      Re: Style Police (a rant) Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2011-09-15 13:46 +0000
                    Re: Style Police (a rant) Arne Vajhøj <arne@vajhoej.dk> - 2011-09-14 21:40 -0400
            Re: Style Police (a rant) Arne Vajhøj <arne@vajhoej.dk> - 2011-09-11 10:59 -0400
              Re: Style Police (a rant) Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2011-09-11 21:25 +0000
    Re: Style Police (a rant) Tom Anderson <twic@urchin.earth.li> - 2011-08-27 14:00 +0100
      Re: Style Police (a rant) Lew <lewbloch@gmail.com> - 2011-08-27 08:42 -0700
      Re: Style Police (a rant) Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-08-27 11:58 -0400
    Re: Style Police (a rant) "John B. Matthews" <nospam@nospam.invalid> - 2011-08-28 08:21 -0400
      Re: Style Police (a rant) Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2011-08-28 18:07 -0300
    Re: Style Police (a rant) Roedy Green <see_website@mindprod.com.invalid> - 2011-08-29 04:20 -0700
    Re: Style Police (a rant) Tim Slattery <Slattery_T@bls.gov> - 2011-08-29 09:11 -0400
      Re: Style Police (a rant) Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-08-29 20:50 -0400
        Re: Style Police (a rant) Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2011-08-30 11:27 +0000
          Re: Style Police (a rant) Lew <lewbloch@gmail.com> - 2011-08-30 09:36 -0700
            Re: Style Police (a rant) Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2011-08-30 17:51 +0000
        Re: Style Police (a rant) Tim Slattery <Slattery_T@bls.gov> - 2011-08-30 08:51 -0400
        Re: Style Police (a rant) Patricia Shanahan <pats@acm.org> - 2011-08-30 09:04 -0700
          Re: Style Police (a rant) Lew <lewbloch@gmail.com> - 2011-08-30 09:43 -0700
            Re: Style Police (a rant) Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> - 2011-08-31 00:31 +0200

Page 2 of 10 — ← Prev page 1 [2] 3 4 … 10  Next page →


#7440

FromLew <lewbloch@gmail.com>
Date2011-08-28 13:09 -0700
Message-ID<a0baf2ce-e796-4234-bd5f-517371f8d292@glegroupsg2000goo.googlegroups.com>
In reply to#7433
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:
<https://www.securecoding.cert.org/confluence/display/java/MET05-J.+Ensure+that+constructors+do+not+call+overridable+methods>
<http://www.oracle.com/technetwork/java/seccodeguide-139067.html>
in particular
<http://www.oracle.com/technetwork/java/seccodeguide-139067.html#4-0> _et seq._

More on "practice safe construction"
<http://www.ibm.com/developerworks/java/library/j-jtp0618/index.html>

and the general antipattern of putting code in a constructor at all:
<http://www.beaconhill.com/solutions/kb/java/code-in-constructor-anti-pattern.html>

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

[toc] | [prev] | [next] | [standalone]


#7447

FromJan Burse <janburse@fastmail.fm>
Date2011-08-29 04:02 +0200
Message-ID<j3erv0$eh9$1@news.albasani.net>
In reply to#7440
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

[toc] | [prev] | [next] | [standalone]


#7449

FromLew <lewbloch@gmail.com>
Date2011-08-28 19:20 -0700
Message-ID<d8493a6e-9a0d-414f-80ad-2d88bee97c62@glegroupsg2000goo.googlegroups.com>
In reply to#7447
On Sunday, August 28, 2011 7:02:07 PM UTC-7, Jan Burse wrote:
> 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.

You need to read the Java Language Specification.
JLS §8.4.3.3 "final Methods"
"A private method and all methods declared immediately within a final class (§8.1.1.2) behave as if they are final, since it is impossible to override them."

In the context of this conversation, calling overridable methods from a constructor, this is relevant because there is no danger of an "override" of a private method causing untoward behavior from the constructor of the parent class.

> 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.

So what?

> But since private methods are compiled into a static

Bad choice of words.  I know what you mean, but "static" has a particular meaning in Java and this isn't it.

> 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.

But still cannot be called by the superclass instance on itself.

-- 
Lew

[toc] | [prev] | [next] | [standalone]


#7458

FromJan Burse <janburse@fastmail.fm>
Date2011-08-29 09:44 +0200
Message-ID<j3fg11$8jf$1@news.albasani.net>
In reply to#7449
Lew schrieb:
> "A private method and all methods declared immediately
 > within a final class (§8.1.1.2) behave as if they are
 > final, since it is impossible to override them."

The above refers to a final class and not to a final
method.

private methods can be overshadowed. You can try the
following code by yourself:

     class A {
        private void init() { };
     }

     class B extends A {
        public void init() { };
     }

It does compile, and the class loader does also
accept it.

 > Bad choice of words.  I know what you mean, but
 > "static" has a particular meaning in Java and this
 > isn't it.

Oops, I had in mind that there are instructions invokestatic
and invokedynamic, but infact the relevant instructions
are called invokespecial and invokevirtual.

The invokespecial instruction is used for private methods.
See here:
http://cs.au.dk/~mis/dOvs/jvmspec/ref--33.html

Bye

[toc] | [prev] | [next] | [standalone]


#7467

FromLew <lewbloch@gmail.com>
Date2011-08-29 08:30 -0700
Message-ID<8e9ab8cb-bfff-41f6-a995-5ff570acc683@glegroupsg2000goo.googlegroups.com>
In reply to#7458
Jan Burse wrote:
> Lew schrieb:
>> "A private method and all methods declared immediately
>> within a final class (§8.1.1.2) behave as if they are
>> final, since it is impossible to override them."
> 
> The above refers to a final class and not to a final
> method.

Then why does it say "private method"?

> private methods can be overshadowed. You can try the
> following code by yourself:
> 
>      class A {
>         private void init() { };
>      }
> 
>      class B extends A {
>         public void init() { };
>      }
> 
> It does compile, and the class loader does also
> accept it.

So what?

The constructor of 'A' still can't call the 'init()' of 'B', which is the key point here.  In fact, nothing in class 'A' can call the 'init()' of 'B' via 'this'; that is why the JLS says flat out that 'private' methods work like 'final' ones.

-- 
Lew

[toc] | [prev] | [next] | [standalone]


#7473

FromAndreas Leitgeb <avl@gamma.logic.tuwien.ac.at>
Date2011-08-29 16:37 +0000
Message-ID<slrnj5ng35.6gl.avl@gamma.logic.tuwien.ac.at>
In reply to#7467
Lew <lewbloch@gmail.com> wrote:
> Jan Burse wrote:
>> private methods can be overshadowed. You can try the
>> following code by yourself:
>>      class A {
>>         private void init() { };
>>      }
>>      class B extends A {
>>         public void init() { };
>>      }
> The constructor of 'A' still can't call the 'init()' of 'B',
> which is the key point here.

> In fact, nothing in class 'A' can call the 'init()' of 'B'
> via 'this';

Umm...   within a C'tor or method of A:
  if (this instanceof B) { ((B)this).init(); } ?

Just nitpicking - probably wrong once again, but curious about
the "how": is my interpretation of "via" too general?  Is there
a specific meaning of the idiom "calling via" in the JLS?

Btw., that doesn't question the original and main point, anyway.

[toc] | [prev] | [next] | [standalone]


#7475

FromLew <lewbloch@gmail.com>
Date2011-08-29 12:10 -0700
Message-ID<0ef6e7bb-e36a-4d0f-98db-45262015f5f0@glegroupsg2000goo.googlegroups.com>
In reply to#7473
Andreas Leitgeb wrote:
> Lew wrote:
>> Jan Burse wrote:
>>> private methods can be overshadowed. You can try the
>>> following code by yourself:
>>>      class A {
>>>         private void init() { };
>>>      }
>>>      class B extends A {
>>>         public void init() { };
>>>      }
>> The constructor of 'A' still can't call the 'init()' of 'B',
>> which is the key point here.
> 
>> In fact, nothing in class 'A' can call the 'init()' of 'B'
>> via 'this';
> 
> Umm...   within a C'tor or method of A:
>   if (this instanceof B) { ((B)this).init(); } ?

Good point, if bad code, and I'll include that in the SSCCE I'm planning to make.

> Just nitpicking - probably wrong once again, but curious about
> the "how": is my interpretation of "via" too general?  Is there
> a specific meaning of the idiom "calling via" in the JLS?

There is no meaning for "calling via" in the JLS of which I'm aware.  I was trying to be clear only that I didn't mean via composition.  Your corner case is interesting but outside of what I was trying to say.

> Btw., that doesn't question the original and main point, anyway.

It's a cute corner case.  Of course it's bad form to downcast 'this' from a parent class to begin with.

-- 
Lew

[toc] | [prev] | [next] | [standalone]


#7472

FromRobert Klemme <shortcutter@googlemail.com>
Date2011-08-29 18:21 +0200
Message-ID<9c1sjvF1hdU1@mid.individual.net>
In reply to#7458
On 29.08.2011 09:44, Jan Burse wrote:
> Lew schrieb:
>> "A private method and all methods declared immediately
>  > within a final class (§8.1.1.2) behave as if they are
>  > final, since it is impossible to override them."
>
> The above refers to a final class and not to a final
> method.

Read like this: "(A private method) and (all methods declared 
immediately within a final class (§8.1.1.2)) behave as if they are 
final, since it is impossible to override them."  In other words

P"final"(m) OR P"declared immediately within a final class"(m) => 
P"behaves as if final"(m).

> private methods can be overshadowed. You can try the
> following code by yourself:
>
> class A {
> private void init() { };
> }
>
> class B extends A {
> public void init() { };
> }
>
> It does compile, and the class loader does also
> accept it.

But you can never invoke A.init() from methods in B or descendants. 
A.init() is final because it can only ever be seen in A.

Kind regards

	robert


-- 
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/

[toc] | [prev] | [next] | [standalone]


#7448

FromJan Burse <janburse@fastmail.fm>
Date2011-08-29 04:06 +0200
Message-ID<j3es7s$etl$1@news.albasani.net>
In reply to#7440
Lew schrieb:
> (So are static methods.)

Static methods are also not final. They can also
be overshadowed. Typical confusion are the
following code snippets:

    class A {
       public static main ...
    }

    class B extends A {
    }

B does not have a main method. It is not
inherited.

    class C extends A {
       public static main ...
    }

C has a main method. And it is different
from the one in A.

Bye

[toc] | [prev] | [next] | [standalone]


#7761

FromWanja Gayk <brixomatic@yahoo.com>
Date2011-09-10 06:45 +0200
Message-ID<MPG.28d509bfb828d36d9896ad@202.177.16.121>
In reply to#7412
In article <j3akb0$61g$1@news.albasani.net>, janburse@fastmail.fm 
says...
> 
> Eric Sosman schrieb:
> >      BUT if you have a concrete non-final method that actually *does*
> > something, you have not "designed for extension."  It's all in aid of
> > somebody's theory about programming style: You're all right as long as
> 
> I have noticed that final methods sometimes execute faster
> than non-final methods. The final modifier gives a hint to
> the optimizers.

Well, that myth is well debunked and if you're measuring some 
significant speeduph, maybe you should double check very closely what 
you're measuring (i.e. the "currentTimeMillis() method's variance can be 
up to 10 ms, sometimes the order of execution influences the measures, 
the JIT-Compile-Times and the GC). Putting up a microbenchmark that is 
not flawed can be a pretty daunting task.
These could are pretty good primers on the topic:
http://www.ibm.com/developerworks/java/library/j-jtp02225/index.html
http://www.ibm.com/developerworks/library/j-jtp12214/

That doesn't keep me from using final on references (not 
methods/classes) wherever possible and also refactoring my code to use 
that keyword when it does not compromise readability too much. The 
reason is that it makes understanding code easier for me.
Once you're used to seeing "final" everwhere, you'll especially note 
those places which are not marked finally; because they are the minority 
they stand out, they catch your attention. These are the variables - in 
the very sense of the word. The less variables you've got keep in mind, 
the easier it is to understand what code does. It has served me very 
well in the past 10 years and I do think it's worth the effort. You may 
argue that it is no good for methods which are basically just 3 lines 
long, but I'll do it there anyway: To avoid blurring the concept, 
keeping the habit, keeping the "not final means attention!" sense sharp.

So I'd like to use "final" to express my intention in code very 
precisely, I'm not doing it for optimizing things.
It's a shame that in Java not all references are implicitly final and 
only real variables get marked with "var" instead - that would serve the 
same purpose with less effort and less visual clutter.

Also with putting final in front of all method parameterts, long lists 
of parameters begin to smell and cry for a refactoring earlier, which 
isn't really a bad thing in my opinion (depends on code-formatting 
though).

Kind regards,
Wanja


-- 
..Alesi's problem was that the back of the car was jumping up and down 
dangerously - and I can assure you from having been teammate to 
Jean Alesi and knowing what kind of cars that he can pull up with, 
when Jean Alesi says that a car is dangerous - it is. [Jonathan Palmer]

--- Posted via news://freenews.netfront.net/ - Complaints to news@netfront.net ---

[toc] | [prev] | [next] | [standalone]


#7765

FromAndreas Leitgeb <avl@gamma.logic.tuwien.ac.at>
Date2011-09-10 11:40 +0000
Message-ID<slrnj6mj4j.6gl.avl@gamma.logic.tuwien.ac.at>
In reply to#7761
Wanja Gayk <brixomatic@yahoo.com> wrote:
> It's a shame that in Java not all references are implicitly final and 
> only real variables get marked with "var" instead - that would serve the 
> same purpose with less effort and less visual clutter.

It seems like your general coding style differs from mine.  The
percentage of re-assigned variables versus those assigned only
once is large enough, that a "var" keyword would cause more
clutter than putting "final" on each other variable.


I'd favor a different change:  let final variables optionally
have their type inferred:
  final myList = new ArrayList<String>();
Afterall, it is just a handle for some previously obtained value.

[toc] | [prev] | [next] | [standalone]


#7774

FromLew <lewbloch@gmail.com>
Date2011-09-10 14:06 -0700
Message-ID<d056de37-3406-4ea1-950e-cd762fa35b6b@glegroupsg2000goo.googlegroups.com>
In reply to#7765
Andreas Leitgeb wrote:
> Wanja Gayk wrote:
>> It's a shame that in Java not all references are implicitly final and 
>> only real variables get marked with "var" instead - that would serve the 
>> same purpose with less effort and less visual clutter.
> 
> It seems like your general coding style differs from mine.  The
> percentage of re-assigned variables versus those assigned only
> once is large enough, that a "var" keyword would cause more
> clutter than putting "final" on each other variable.
> 
> I'd favor a different change:  let final variables optionally
> have their type inferred:
>   final myList = new ArrayList<String>();
> Afterall, it is just a handle for some previously obtained value.

That idea is more complex than it appears.  Should the inferred type be 'List<String>', 'AbstractList<String>' or 'ArrayList<String>'?  I suspect you would say the last, but really, is it so very, very bad to type

  final List<String> myList = new ArrayList<>();

?  I mean, if you want to talk hard work, an extra second or so of typing really doesn't qualify, especially since the lack of the supposedly "redundant" types would harm readability for maintainers.  As one whose career has involved far more maintenance of existing code than development of new, I much prefer the explicit typing.

Wanja's main point is that 'final' has a semantic purpose, not an optimization one.  I agree that the evidence for the advantage of a 'var' keyword over a 'final' is lacking, but it's moot since 'final' is already part of the language and the addition of 'var' is unlikely to occur.  Also, styles vary widely, as you aptly point out.  As long as the purpose is semantic, I recommend broad acceptance for different ways to use 'final'.

To repeat, the key point about 'final' is that it prevents reassignment of variables, overriding methods or class extension.  Such prevention is a matter of art, but that is the purpose.  Not optimization, not really ease of reading (which as I stated I find important), but prevention of these various forms of reassignment.  Use 'final' when you mean for something to be final, not for false economies.

-- 
Lew

[toc] | [prev] | [next] | [standalone]


#7797

FromAndreas Leitgeb <avl@gamma.logic.tuwien.ac.at>
Date2011-09-11 14:07 +0000
Message-ID<slrnj6pg53.6gl.avl@gamma.logic.tuwien.ac.at>
In reply to#7774
Lew <lewbloch@gmail.com> wrote:
> Andreas Leitgeb wrote:
>> I'd favor a different change:  let final variables optionally
>> have their type inferred:
>>   final myList = new ArrayList<String>();
>> Afterall, it is just a handle for some previously obtained value.
> That idea is more complex than it appears.  Should the inferred type be
> 'List<String>', 'AbstractList<String>' or 'ArrayList<String>'?
> I suspect you would say the last,

You suspected right, which is no surprise, as it is the only reasonable
choice in that particular context.

> but really, is it so very, very bad to type
>   final List<String> myList = new ArrayList<>();

I find the direction of the inferral somewhat unlucky.
I'd rather infer the type from right(expression) to left(variable),
than the other way round.  I guess that was discussed thoroughly
before it was introduced, so I might just miss knowing those perfect 
arguments against my preferrence.

> ?  I mean, if you want to talk hard work, an extra second or so of
> typing really doesn't qualify,

It seems that you're biased towards reading other's code versus 
writing your own.  Typing long code isn't the problem - typing
redundant boilerplates is ... fatigueing. It dumbs the joy
of programming.

> especially since the lack of the supposedly "redundant" types would
> harm readability for maintainers.  

That is a claim, of whose truth I'm not at all convinced.
If in a particular situation, the type really wasn't obvious,
then there'd still be the choice of making it explicit.

> As one whose career has involved far more maintenance of existing
> code than development of new, I much prefer the explicit typing.
So much to affirm the diagnosed bias...

> Wanja's main point is that 'final' has a semantic purpose, not an
> optimization one.
So far I agree.

>   I agree that the evidence for the advantage of a 'var' keyword
> over a 'final' is lacking,

That Wanja suggested the "var" keyword is an indication of that he has
a bias towards functional programming.  Unlike Arne, I don't say that
"pick a different language" is an appropriate answer. It's ok, to program
functionally in Java, as far as possible in Java-syntax, and that this
may lead to quite a lot of "final"s.
I just disagree with Wanja as to making "final" the default: it's
like bullying others to functional style in Java.

[toc] | [prev] | [next] | [standalone]


#7799

FromArne Vajhøj <arne@vajhoej.dk>
Date2011-09-11 10:55 -0400
Message-ID<4e6ccbde$0$314$14726298@news.sunsite.dk>
In reply to#7797
On 9/11/2011 10:07 AM, Andreas Leitgeb wrote:
> Lew<lewbloch@gmail.com>  wrote:
>> Andreas Leitgeb wrote:
>>> I'd favor a different change:  let final variables optionally
>>> have their type inferred:
>>>    final myList = new ArrayList<String>();
>>> Afterall, it is just a handle for some previously obtained value.
>> That idea is more complex than it appears.  Should the inferred type be
>> 'List<String>', 'AbstractList<String>' or 'ArrayList<String>'?
>> I suspect you would say the last,
>
> You suspected right, which is no surprise, as it is the only reasonable
> choice in that particular context.
>
>> but really, is it so very, very bad to type
>>    final List<String>  myList = new ArrayList<>();
>
> I find the direction of the inferral somewhat unlucky.
> I'd rather infer the type from right(expression) to left(variable),
> than the other way round.  I guess that was discussed thoroughly
> before it was introduced, so I might just miss knowing those perfect
> arguments against my preferrence.

I prefer the Java way.

I believe in some cases you just want to read the left side
and then move further down the code.

Having to read the right side to see what type it is
will just make it more difficult (in that case).

Arne

[toc] | [prev] | [next] | [standalone]


#7840

FromAndreas Leitgeb <avl@gamma.logic.tuwien.ac.at>
Date2011-09-11 23:34 +0000
Message-ID<slrnj6qhct.6gl.avl@gamma.logic.tuwien.ac.at>
In reply to#7799
Arne Vajhøj <arne@vajhoej.dk> wrote:
> On 9/11/2011 10:07 AM, Andreas Leitgeb wrote:
>> I find the direction of the inferral somewhat unlucky.
>> I'd rather infer the type from right(expression) to left(variable),
>> than the other way round.  I guess that was discussed thoroughly
>> before it was introduced, so I might just miss knowing those perfect
>> arguments against my preferrence.
> I believe in some cases you just want to read the left side
> and then move further down the code.
> Having to read the right side to see what type it is
> will just make it more difficult (in that case).

That is at least some argument for the current state.

Thanks for mentioning it.

[toc] | [prev] | [next] | [standalone]


#7800

FromArne Vajhøj <arne@vajhoej.dk>
Date2011-09-11 10:58 -0400
Message-ID<4e6ccc7f$0$314$14726298@news.sunsite.dk>
In reply to#7797
On 9/11/2011 10:07 AM, Andreas Leitgeb wrote:
> Lew<lewbloch@gmail.com>  wrote:
>>    I agree that the evidence for the advantage of a 'var' keyword
>> over a 'final' is lacking,
>
> That Wanja suggested the "var" keyword is an indication of that he has
> a bias towards functional programming.  Unlike Arne, I don't say that
> "pick a different language" is an appropriate answer. It's ok, to program
> functionally in Java, as far as possible in Java-syntax, and that this
> may lead to quite a lot of "final"s.

Java allows it.

I am just a bit skeptical about the maintainability.

Many years ago I saw a person that liked Pascal do the following
in C:

#define begin {
$define end }

The result was not pretty.

I like Pascal, but if I want to code in Pascal then I will use
Pascal not C.

 > I just disagree with Wanja as to making "final" the default: it's
 > like bullying others to functional style in Java.

Arne

[toc] | [prev] | [next] | [standalone]


#7812

FromPatricia Shanahan <pats@acm.org>
Date2011-09-11 10:12 -0700
Message-ID<srGdnQUXQ-OGcfHTnZ2dnUVZ_sKdnZ2d@earthlink.com>
In reply to#7800
On 9/11/2011 7:58 AM, Arne Vajhøj wrote:
...
> Many years ago I saw a person that liked Pascal do the following
> in C:
>
> #define begin {
> $define end }
>
> The result was not pretty.
...

I think I saw some of the same code, or at least code written in a
similar way. I found it totally unreadable, as though it were in a
programming language I didn't know, despite being familiar with both
Pascal and C.

Patricia

[toc] | [prev] | [next] | [standalone]


#8016

FromAndreas Leitgeb <avl@gamma.logic.tuwien.ac.at>
Date2011-09-14 12:22 +0000
Message-ID<slrnj7173b.6gl.avl@gamma.logic.tuwien.ac.at>
In reply to#7800
Arne Vajhøj <arne@vajhoej.dk> wrote:
> Many years ago I saw a person that liked Pascal do the following
> in C:
> #define begin {
> #define end }

Probably it did look better and easier maintainable to the 
respective author than "all those braces".

I've seen a terminal font where braces looked almost the same
as parentheses. Were I ever forced to work with such a terminal,
I might even have done the same...  Can't tell if the author
you wrote about had a reason like that...

[toc] | [prev] | [next] | [standalone]


#8022

FromBent C Dalager <bcd@pvv.ntnu.no>
Date2011-09-14 15:04 +0000
Message-ID<slrnj71gkc.pvk.bcd@microbel.pvv.ntnu.no>
In reply to#7800
On 2011-09-11, Arne Vajhøj <arne@vajhoej.dk> wrote:
> Many years ago I saw a person that liked Pascal do the following
> in C:
>
> #define begin {
> $define end }

The Bourne shell source code is notorious for this apparently.

http://minnie.tuhs.org/cgi-bin/utree.pl?file=V7/usr/src/cmd/sh/mac.h

Bent.
-- 
Bent Dalager - bcd@pvv.org - http://www.pvv.org/~bcd
                                    powered by emacs

[toc] | [prev] | [next] | [standalone]


#8023

FromPaul Cager <paul.cager@googlemail.com>
Date2011-09-14 09:36 -0700
Message-ID<3a691867-c46c-4027-a940-f0cd31888f93@n11g2000yqh.googlegroups.com>
In reply to#8022
On Sep 14, 4:04 pm, Bent C Dalager <b...@pvv.ntnu.no> wrote:

> The Bourne shell source code is notorious for this apparently.
>
> http://minnie.tuhs.org/cgi-bin/utree.pl?file=V7/usr/src/cmd/sh/mac.h


http://www.ioccc.org/faq.html - "How did the IOCCC get started? ".

[toc] | [prev] | [next] | [standalone]


Page 2 of 10 — ← Prev page 1 [2] 3 4 … 10  Next page →

Back to top | Article view | comp.lang.java.programmer


csiph-web