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


Groups > comp.lang.java.programmer > #29242

Re: Java blunders

From Eric Sosman <esosman@comcast-dot-net.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: Java blunders
Date 2014-07-23 15:14 -0400
Organization A noiseless patient Spider
Message-ID <lqp1it$s1g$1@dont-email.me> (permalink)
References <jvbts91r2f9onj1e3dbr5lvqp70hmofkum@4ax.com> <a4b9a521-1f38-4fc0-b131-fda06e47af68@googlegroups.com>

Show all headers | View raw


On 7/23/2014 2:26 PM, taqmcg@gmail.com wrote:
>> You might like to add to the list.
>
> Here are a few possibly idiosyncratic issues I have.  I don't anticipate that any except the last could conceivably be implemented.
>
> - Integer promotion of byte, short and char types:  This really aggravates the problem of bytes being signed.  I've had to clear sign-extensions from promoted bytes or shorts countless times.  The semi-supported status of these types has lots of ramifications.  The special rules for x += y;  where x is a byte and y is an integer is just one.

     As with C before it, this is a concession to the underlying
hardware.  Machines capable of 8-bit arithmetic exist, but nowadays
are found in microcontrollers and the like rather than in servers,
desktops, tablets, and phones.  The architectural tendency has been
to move away from memory-to-memory arithmetic and toward a style of
load-operate-store -- and when you load a "narrow" value into a
"wide" register, you can't just leave the other bits in a state
that's neither one nor zero!

     I'll also take issue with your use of "semi-supported:" Can you
find a Java implementation anywhere, even one implementation, on
which these operations are *not* supported as described in the JLS?

> - The vast mess that is Java IO and NIO with a myriad of classes that do almost the same thing.  Streams and Readers and Channels and RandomAccessFile off on its own, and Buffers and Formatters and Charsets and Selectors and ....   My suspicion is the the underlying problem here is that we've decided that I/O somehow is read out of the language itself -- it's an add-on library.  Doing I/O is critical to essentially all programs but thinking that some syntax beyond method calls might be useful in making what how program does I/O clear is beyond the pale.  I suspect that the desire to support printf-like calls was one of the big drivers for variable length argument lists but that's not even scratching the surface.

     The class libraries testify to the fact that their designers had
not yet read "Effective Java" or gained comparable experience.  Of
course, they would have to have been unusually prescient to do so ...

> - Statements with side effects: This infection has been virally grafted into core genes of many C-based languages.  While the ability to do
>
>     a += b;
>
> is a tremendous boon and quite clear, the added benefit of
>
>     a += b += c;
> versus
>     b += c;
>     a += b;
> is lost to me.  The first suggests the wrong order.  The second is clear and
> unambiguous.

     Seems clear enough to me -- although I can't recall, off-hand, a
situation where I'd have found the construct useful.  I think it's
more of a gotcha question for a snarky Java exam than something that
would arise much in practice.

     More broadly: Java is an imperative language.  In an imperative
framework it's hard to see how one could manage without side-effects:
No assignments, no methods that modify Collections, no I/O ... I guess
a language that did none of these things could compute, in a fashion,
but I'm not sure how you could prove that it had done so.

> The prime vector in this contagion are the increment and decrement operators, which I completely eschew.  (I use x += 1 or x -= 1 instead).  So increments, decrements and assignments should (imho) be statements, not values.

     De gustibus non disputandum est.  Java syntax is pretty obese
already; anything that liposuctions even a little fat away is something
I applaud.

> 4. The switch statement.  The problems with fall through have already been noted, but it also seems silly that switches are restricted to a limited set of
> types.  One should be able to switch on any value: String, double, Objects, enumerations ....  Just use == [for primitives] or equals() [for objects] to find the appropriate case.  Sometimes this is just syntactic sugar for a
> nested if, but that's fine.  The nested if's hide the constraints, while a switch can be much clearer.  I don't see why the compiler can't easily optimize the integer and enumeration switches but leave the language more powerful and simpler (i.e., there are fewer special cases).

     IMHO Java would be a better language if `switch' were removed
altogether, fall-through or not.  But that's just MHO, which (clearly)
is not widely shared.  Meanwhile, I oppose anything that encourages
the use of the construct.

> Just a few of my pet peeves.

     Here's one I haven't seen mentioned yet: I think the precedence
of `instanceof' w.r.t. `!' is wrong:

	// What I want:
	if (! thing instanceof T)   // if it's not a "T" ...

	// What I must write instead:
	if (!(thing instanceof T))  // if it's false that it's a "T" ...

Anybody else?

-- 
esosman@comcast-dot-net.invalid

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Java blunders Roedy Green <see_website@mindprod.com.invalid> - 2014-07-22 11:41 -0700
  Re: Java blunders Daniele Futtorovic <da.futt.news@laposte.net> - 2014-07-22 21:12 +0200
    Re: Java blunders Arne Vajhøj <arne@vajhoej.dk> - 2014-07-22 19:46 -0400
      Re: Java blunders Roedy Green <see_website@mindprod.com.invalid> - 2014-07-23 04:14 -0700
  Re: Java blunders Joerg Meier <joergmmeier@arcor.de> - 2014-07-22 23:47 +0200
    Re: Java blunders Roedy Green <see_website@mindprod.com.invalid> - 2014-07-23 04:23 -0700
      Re: Java blunders Martin Gregorie <martin@address-in-sig.invalid> - 2014-07-23 12:32 +0000
        Re: Java blunders Eric Sosman <esosman@comcast-dot-net.invalid> - 2014-07-23 08:55 -0400
          Re: Java blunders Roedy Green <see_website@mindprod.com.invalid> - 2014-07-23 06:21 -0700
        Re: Java blunders Arne Vajhøj <arne@vajhoej.dk> - 2014-07-23 19:53 -0400
          Re: Java blunders Roedy Green <see_website@mindprod.com.invalid> - 2014-07-23 18:49 -0700
      Re: Java blunders Arne Vajhøj <arne@vajhoej.dk> - 2014-07-23 19:52 -0400
  Re: Java blunders Arne Vajhøj <arne@vajhoej.dk> - 2014-07-22 19:44 -0400
    Re: Java blunders Roedy Green <see_website@mindprod.com.invalid> - 2014-07-23 04:27 -0700
      Re: Java blunders Arne Vajhøj <arne@vajhoej.dk> - 2014-07-23 19:55 -0400
        Re: Java blunders Roedy Green <see_website@mindprod.com.invalid> - 2014-07-23 18:53 -0700
          Re: Java blunders Joerg Meier <joergmmeier@arcor.de> - 2014-07-24 11:24 +0200
            Re: Java blunders Roedy Green <see_website@mindprod.com.invalid> - 2014-07-25 06:34 -0700
          Re: Java blunders Arne Vajhøj <arne@vajhoej.dk> - 2014-07-24 19:31 -0400
            Re: Java blunders Gene Wirchenko <genew@telus.net> - 2014-07-25 13:22 -0700
              Re: Java blunders Eric Sosman <esosman@comcast-dot-net.invalid> - 2014-07-25 17:17 -0400
                Re: Java blunders Martin Gregorie <martin@address-in-sig.invalid> - 2014-07-25 23:12 +0000
                Re: Java blunders Roedy Green <see_website@mindprod.com.invalid> - 2014-07-26 09:06 -0700
                Re: Java blunders Martin Gregorie <martin@address-in-sig.invalid> - 2014-07-26 20:11 +0000
                Re: Java blunders Eric Sosman <esosman@comcast-dot-net.invalid> - 2014-07-26 17:27 -0400
                Re: Java blunders Roedy Green <see_website@mindprod.com.invalid> - 2014-07-27 10:49 -0700
                Re: Java blunders Roedy Green <see_website@mindprod.com.invalid> - 2014-07-27 10:10 -0700
                Re: Java blunders Gene Wirchenko <genew@telus.net> - 2014-07-28 13:53 -0700
                Re: Java blunders Stuart <DerTopper@web.de> - 2014-07-30 08:05 +0200
                Re: Java blunders Sebastian <news@seyweiler.dyndns.org> - 2014-07-30 11:12 +0200
                Re: Java blunders Roedy Green <see_website@mindprod.com.invalid> - 2014-07-27 10:13 -0700
                Re: Java blunders Martin Gregorie <martin@address-in-sig.invalid> - 2014-07-27 18:28 +0000
                Re: Java blunders Eric Sosman <esosman@comcast-dot-net.invalid> - 2014-07-27 14:46 -0400
                Re: Java blunders Martin Gregorie <martin@address-in-sig.invalid> - 2014-07-27 21:18 +0000
                Re: Java blunders Eric Sosman <esosman@comcast-dot-net.invalid> - 2014-07-27 18:10 -0400
                Re: Java blunders Martin Gregorie <martin@address-in-sig.invalid> - 2014-07-28 01:25 +0000
                Re: Java blunders Eric Sosman <esosman@comcast-dot-net.invalid> - 2014-07-28 08:02 -0400
                Re: Java blunders Mike Amling <mamling@chaff.us> - 2014-07-31 13:26 -0500
                Re: Java blunders Eric Sosman <esosman@comcast-dot-net.invalid> - 2014-07-31 14:48 -0400
                Re: Java blunders "Chris Uppal" <chris.uppal@metagnostic.REMOVE-THIS.org> - 2014-07-28 13:22 +0100
                Re: Java blunders Martin Gregorie <martin@address-in-sig.invalid> - 2014-07-28 12:52 +0000
                Re: Java blunders Joerg Meier <joergmmeier@arcor.de> - 2014-07-28 23:38 +0200
                Re: Java blunders Martin Gregorie <martin@address-in-sig.invalid> - 2014-07-28 23:17 +0000
                Re: Java blunders Silvio <silvio@internet.com> - 2014-07-29 13:34 +0200
                Re: Java blunders Martin Gregorie <martin@address-in-sig.invalid> - 2014-07-29 12:45 +0000
                Re: Java blunders Silvio <silvio@internet.com> - 2014-07-29 17:10 +0200
                Re: Java blunders Martin Gregorie <martin@address-in-sig.invalid> - 2014-07-29 16:29 +0000
                Re: Java blunders lipska the kat <lipskathekat@example.com> - 2014-07-29 20:15 +0100
                Re: Java blunders Martin Gregorie <martin@address-in-sig.invalid> - 2014-07-29 22:02 +0000
                Re: Java blunders Silvio <silvio@internet.com> - 2014-07-29 22:43 +0200
                Re: Java blunders Martin Gregorie <martin@address-in-sig.invalid> - 2014-07-29 22:10 +0000
                Re: Java blunders Joshua Cranmer 🐧 <Pidgeot18@verizon.invalid> - 2014-07-27 19:18 -0500
                Re: Java blunders Gene Wirchenko <genew@telus.net> - 2014-07-28 13:54 -0700
                Re: Java blunders Arne Vajhøj <arne@vajhoej.dk> - 2014-07-31 23:07 -0400
                Re: Java blunders James Hostick <james.hostick@gmail.com> - 2014-08-01 22:10 -0700
            Re: Java blunders Roedy Green <see_website@mindprod.com.invalid> - 2014-07-26 08:31 -0700
              Re: Java blunders Martin Gregorie <martin@address-in-sig.invalid> - 2014-07-26 21:04 +0000
                Re: Java blunders Roedy Green <see_website@mindprod.com.invalid> - 2014-07-27 10:51 -0700
                Re: Java blunders Roedy Green <see_website@mindprod.com.invalid> - 2014-07-28 08:50 -0700
                Re: Java blunders Joerg Meier <joergmmeier@arcor.de> - 2014-07-28 23:42 +0200
              Re: Java blunders Arne Vajhøj <arne@vajhoej.dk> - 2014-07-31 23:04 -0400
          Re: Java blunders Josip Almasi <joe@vrspace.org> - 2014-07-28 22:23 +0200
            Re: Java blunders Eric Sosman <esosman@comcast-dot-net.invalid> - 2014-07-28 16:39 -0400
              Re: Java blunders Josip Almasi <joe@vrspace.org> - 2014-07-29 00:11 +0200
              Re: Java blunders Jukka Lahtinen <jtfjdehf@hotmail.com.invalid> - 2014-07-30 12:07 +0300
                Re: Java blunders Eric Sosman <esosman@comcast-dot-net.invalid> - 2014-07-30 08:05 -0400
    Re: Java blunders Wanja Gayk <brixomatic@yahoo.com> - 2014-07-25 01:34 +0200
      Re: Java blunders Arne Vajhøj <arne@vajhoej.dk> - 2014-07-24 19:43 -0400
  Re: Java blunders Joshua Cranmer 🐧 <Pidgeot18@verizon.invalid> - 2014-07-22 21:02 -0500
    Re: Java blunders Leif Roar Moldskred <leifm@huldreskog.lan> - 2014-07-23 02:01 -0500
      Re: Java blunders Roedy Green <see_website@mindprod.com.invalid> - 2014-07-23 18:58 -0700
      Re: Java blunders thinbluernime <thinbluernime3@gmail.com> - 2014-07-25 03:55 +0000
        Re: Java blunders Leif Roar Moldskred <leifm@huldreskog.lan> - 2014-07-25 00:32 -0500
          Re: Java blunders thinbluernime <thinbluernime3@gmail.com> - 2014-07-26 07:28 +0000
            Re: Java blunders "Gavino" <invalid@invalid.invalid> - 2014-07-26 19:43 +0200
        Re: Java blunders Roedy Green <see_website@mindprod.com.invalid> - 2014-07-25 06:36 -0700
          Re: Java blunders "Chris Uppal" <chris.uppal@metagnostic.REMOVE-THIS.org> - 2014-07-25 15:47 +0100
            Re: Java blunders David Postill <david.postill@gmail.com> - 2014-07-25 18:29 +0200
            Re: Java blunders Roedy Green <see_website@mindprod.com.invalid> - 2014-07-26 09:27 -0700
        Re: Java blunders Roedy Green <see_website@mindprod.com.invalid> - 2014-07-25 06:37 -0700
    Re: Java blunders Joerg Meier <joergmmeier@arcor.de> - 2014-07-23 13:17 +0200
      Re: Java blunders Roedy Green <see_website@mindprod.com.invalid> - 2014-07-23 06:27 -0700
    Re: Java blunders Roedy Green <see_website@mindprod.com.invalid> - 2014-07-23 04:44 -0700
      Re: Java blunders Silvio <silvio@internet.com> - 2014-07-23 16:23 +0200
        Re: Java blunders Eric Sosman <esosman@comcast-dot-net.invalid> - 2014-07-23 12:02 -0400
          Re: Java blunders Silvio <silvio@internet.com> - 2014-07-24 11:37 +0200
            Re: Java blunders Josip Almasi <joe@vrspace.org> - 2014-07-28 22:37 +0200
        Re: Java blunders Roedy Green <see_website@mindprod.com.invalid> - 2014-07-23 09:33 -0700
          Re: Java blunders thinbluernime <thinbluernime3@gmail.com> - 2014-07-25 03:57 +0000
        Re: Java blunders Arne Vajhøj <arne@vajhoej.dk> - 2014-07-23 21:38 -0400
          Re: Java blunders Roedy Green <see_website@mindprod.com.invalid> - 2014-07-23 18:59 -0700
            Re: Java blunders Martin Gregorie <martin@address-in-sig.invalid> - 2014-07-24 07:33 +0000
          Re: Java blunders Silvio <silvio@internet.com> - 2014-07-24 11:47 +0200
            Re: Java blunders Arne Vajhøj <arne@vajhoej.dk> - 2014-07-24 19:34 -0400
              Re: Java blunders Silvio <silvio@internet.com> - 2014-07-25 08:48 +0200
                Re: Java blunders Eric Sosman <esosman@comcast-dot-net.invalid> - 2014-07-25 08:07 -0400
                Re: Java blunders "Chris Uppal" <chris.uppal@metagnostic.REMOVE-THIS.org> - 2014-07-25 13:54 +0100
                Re: Java blunders Arne Vajhøj <arne@vajhoej.dk> - 2014-07-31 22:53 -0400
            Re: Java blunders Roedy Green <see_website@mindprod.com.invalid> - 2014-07-25 07:04 -0700
        Re: Java blunders Josip Almasi <joe@vrspace.org> - 2014-07-28 22:01 +0200
      Re: Java blunders Josip Almasi <joe@vrspace.org> - 2014-07-28 21:56 +0200
    Re: Java blunders Roedy Green <see_website@mindprod.com.invalid> - 2014-07-23 06:28 -0700
      Re: Java blunders Joshua Cranmer 🐧 <Pidgeot18@verizon.invalid> - 2014-07-23 08:33 -0500
    Re: Java blunders Arne Vajhøj <arne@vajhoej.dk> - 2014-07-23 21:34 -0400
      Re: Java blunders Roedy Green <see_website@mindprod.com.invalid> - 2014-07-23 19:06 -0700
      Re: Java blunders Joshua Cranmer 🐧 <Pidgeot18@verizon.invalid> - 2014-07-23 22:11 -0500
        Re: Java blunders Martin Gregorie <martin@address-in-sig.invalid> - 2014-07-24 07:36 +0000
          Re: Java blunders Arne Vajhøj <arne@vajhoej.dk> - 2014-07-24 19:39 -0400
            Re: Java blunders "Chris Uppal" <chris.uppal@metagnostic.REMOVE-THIS.org> - 2014-07-25 13:40 +0100
        Re: Java blunders Arne Vajhøj <arne@vajhoej.dk> - 2014-07-24 19:38 -0400
          Re: Java blunders Gene Wirchenko <genew@telus.net> - 2014-07-25 13:30 -0700
  Re: Java blunders taqmcg@gmail.com - 2014-07-23 11:26 -0700
    Re: Java blunders Eric Sosman <esosman@comcast-dot-net.invalid> - 2014-07-23 15:14 -0400
      Re: Java blunders thinbluernime <thinbluernime3@gmail.com> - 2014-07-25 04:07 +0000
        Re: Java blunders Eric Sosman <esosman@comcast-dot-net.invalid> - 2014-07-25 08:35 -0400
          Re: Java blunders Roedy Green <see_website@mindprod.com.invalid> - 2014-07-26 09:41 -0700
        Re: Java blunders Wanja Gayk <brixomatic@yahoo.com> - 2014-08-03 16:41 +0200
          Re: Java blunders Eric Sosman <esosman@comcast-dot-net.invalid> - 2014-08-03 11:31 -0400
    Re: Java blunders Joshua Cranmer 🐧 <Pidgeot18@verizon.invalid> - 2014-07-23 22:41 -0500
      Re: Java blunders taqmcg@gmail.com - 2014-07-24 10:09 -0700
        Re: Java blunders "Chris Uppal" <chris.uppal@metagnostic.REMOVE-THIS.org> - 2014-07-25 13:22 +0100
        Re: Java blunders Joshua Cranmer 🐧 <Pidgeot18@verizon.invalid> - 2014-07-25 20:34 -0500
          Re: Java blunders "Chris Uppal" <chris.uppal@metagnostic.REMOVE-THIS.org> - 2014-07-28 13:33 +0100
            Re: Java blunders Joshua Cranmer 🐧 <Pidgeot18@verizon.invalid> - 2014-07-28 08:35 -0500
        Re: Java blunders Roedy Green <see_website@mindprod.com.invalid> - 2014-07-26 09:44 -0700
          Re: Java blunders Martin Gregorie <martin@address-in-sig.invalid> - 2014-07-26 23:36 +0000
  Re: Java blunders Gene Wirchenko <genew@telus.net> - 2014-07-23 20:48 -0700
    Re: Java blunders Silvio <silvio@internet.com> - 2014-07-24 11:56 +0200
      Re: Java blunders Silvio <silvio@internet.com> - 2014-07-24 16:07 +0200
        Re: Java blunders Gene Wirchenko <genew@telus.net> - 2014-07-25 13:38 -0700
          Re: Java blunders Roedy Green <see_website@mindprod.com.invalid> - 2014-07-26 10:02 -0700
    Re: Java blunders Arne Vajhøj <arne@vajhoej.dk> - 2014-07-24 19:29 -0400
      Re: Java blunders Gene Wirchenko <genew@telus.net> - 2014-07-25 13:45 -0700
    Re: Java blunders Roedy Green <see_website@mindprod.com.invalid> - 2014-07-26 10:53 -0700
  Re: Java blunders Wanja Gayk <brixomatic@yahoo.com> - 2014-07-25 01:28 +0200
  Re: Java blunders "Chris Uppal" <chris.uppal@metagnostic.REMOVE-THIS.org> - 2014-07-25 14:16 +0100
  Re: Java blunders Joerg Meier <joergmmeier@arcor.de> - 2014-07-25 17:39 +0200
  Re: Java blunders Roedy Green <see_website@mindprod.com.invalid> - 2014-07-26 16:21 -0700
  Re: Java blunders Josip Almasi <joe@vrspace.org> - 2014-07-28 23:59 +0200
    Re: Java blunders Josip Almasi <joe@vrspace.org> - 2014-07-29 00:41 +0200
      Re: Java blunders Josip Almasi <joe@vrspace.org> - 2014-07-29 01:54 +0200
    Re: Java blunders Arne Vajhøj <arne@vajhoej.dk> - 2014-07-31 22:38 -0400
    Re: Java blunders Arne Vajhøj <arne@vajhoej.dk> - 2014-07-31 22:39 -0400
  Re: Java blunders w.tom.adams@gmail.com - 2014-07-30 07:57 -0700
    Re: Java blunders Joshua Cranmer 🐧 <Pidgeot18@verizon.invalid> - 2014-07-30 10:22 -0500

csiph-web