From: Thomas Pornin on 18 Mar 2010 09:53 According to Lew <noone(a)lewscanon.com>: > and it certainly has added powerful compile-time bug detection to Java. I am not sure of that "bug" thing. Generics make life easier because they avoids the need for a bunch of casts; they also are quite good at documenting container types. But in practice it does not seem to detect more bugs: the bugs it may detect are bugs that I was not doing in the first place. It is _convenient_ that when I call a method which returns a Collection<String> I know that the collection contains String instances. But in pre-Java-5 code, I would have got a "Collection" and I would have looked at the documentation to know what that Collection contains. Generics may detect a bug only if, in that situation, I would have boldly and wrongly assumed that the Collection contained something else. This is not something which was actually happening at that time. In brief, generics do not solve a bug-related problem that I had. They do improve a documentation-related problem that I had -- namely with code written by other people with poor documentation. They also make code more readable due to the visual clutter implied by the extra casts. Generics thus allow me to write code faster, because I waste less time wading through external documentation and I can fit more useful code in my eye-brain system. But bugs ? Nope. Basically, after using Java and generics quite extensively, I simply do not buy the marketing slogan "generics add powerful compile-time bug detection". I also note that the same slogan has been used for C++ (with regards to C) and I do not buy it either. In both situation it is a "nice intent", the kind Hell is paved of. --Thomas Pornin
From: Mike Schilling on 18 Mar 2010 11:32 Roedy Green wrote: > On Wed, 17 Mar 2010 15:55:53 -0700, "Mike Schilling" > <mscottschilling(a)hotmail.com> wrote, quoted or indirectly quoted > someone who said : > >> Yes, Roedy, I know what thty are, but they're not relevant to what I >> was exploring. >> > > You were complaining that generic docs do not cover autoboxing and > widening. Where the hell did that come from?
From: Mike Schilling on 18 Mar 2010 11:35 Thomas Pornin wrote: > Basically, after using Java and generics quite extensively, I simply > do not buy the marketing slogan "generics add powerful compile-time > bug detection". I also note that the same slogan has been used for > C++ (with regards to C) and I do not buy it either. In both situation > it is a "nice intent", the kind Hell is paved of. Function prototypes, invented in C++ and then retrofutted into C, prevent a large number of bugs caused by not getting the calling sequence of a function quite right.
From: Eric Sosman on 18 Mar 2010 11:40 On 3/18/2010 11:32 AM, Mike Schilling wrote: > Roedy Green wrote: >> On Wed, 17 Mar 2010 15:55:53 -0700, "Mike Schilling" >> <mscottschilling(a)hotmail.com> wrote, quoted or indirectly quoted >> someone who said : >> >>> Yes, Roedy, I know what thty are, but they're not relevant to what I >>> was exploring. >>> >> >> You were complaining that generic docs do not cover autoboxing and >> widening. > > Where the hell did that come from? Don't feel bad that you don't see your complaints, Mike. Neither can I. Perhaps we have similar difficulties with reading comprehension. -- Eric Sosman esosman(a)ieee-dot-org.invalid
From: Martin Gregorie on 18 Mar 2010 14:01
On Thu, 18 Mar 2010 08:35:29 -0700, Mike Schilling wrote: > Thomas Pornin wrote: >> Basically, after using Java and generics quite extensively, I simply do >> not buy the marketing slogan "generics add powerful compile-time bug >> detection". I also note that the same slogan has been used for C++ >> (with regards to C) and I do not buy it either. In both situation it is >> a "nice intent", the kind Hell is paved of. > ^^ s/of/with/ ....please. Like the UK nastiness, "the england team", I find the Americanism of using 'of' instead of 'with' very irritating. Arrrr, I feel better with that off my chest. > Function prototypes, invented in C++ and then retrofutted into C, > prevent a large number of bugs caused by not getting the calling > sequence of a function quite right. > So that's where it came from. I'd always assumed it was an ANSI C import from one of the Algols or Pascal. I still have a system with a K&R C compiler and really miss ANSI function prototypes every time I write something for it. -- martin@ | Martin Gregorie gregorie. | Essex, UK org | |