Re: Java Generics and Erasure foobar



Peter D. wrote:

I'm not a very experienced programmer. I've been working for a java
house for almost a year. But it seems to me HackerBob has more
experience writing code than reading it. Reading code that uses
generics makes it so much faster to learn and understand the code. It
is much easier to see what is what when it is plainly written out for
you. So IMHO not only do generics help to find problems earlier but
also help when you've inherited a code base and need to learn how it
all works quickly.

It seems to me that HackerBob has little experience maintaining code as well. Remember that last box in the classic waterfall diagram? It's pretty important. Some projects have more money spent on them during the maintenance phase than during the design-develop-test phases combined.

Generics helps ensure that someone else reading your code won't see that a method (let's say List add(Object)) doesn't take an Object at all but instead requires a String or Integer. With a modern IDE, these mistake aren't caught at compile time but earlier, as the editor will display the method documentation as you type. (And flag errors too after you type them.)

Or instead of "someone else" yourself 18 months after you last touched a package you wrote.

Bob seems overly focused on his typing and seems to be lacking a larger perspective.
.



Relevant Pages

  • Re: Targeting builds for .NET FW 1.1 using VS 2005
    ... I remember reading somewhere about a VS2005 setting ... >that would disallow .NET 2.0 language features, like generics. ...
    (microsoft.public.dotnet.framework)
  • Re: Studying Generics
    ... I've bought Oreilly's "Java Generics", ... really like it - After reading it, many topics still seem unclear to me. ... Then look at Sun Collection code that makes extensive use of generics ...
    (comp.lang.java.programmer)
  • Re: Still no typedef
    ... some variable using generics can be quite long. ... Maybe they save the typing, ... reading over that bulk lateron :-) ...
    (comp.lang.java.programmer)
  • Re: Studying Generics
    ... I've bought Oreilly's "Java Generics", but so far I don't really like it - After reading it, many topics still seem unclear to me. ... (Hmm, imagine that - material on java.sun.com!) ...
    (comp.lang.java.programmer)
  • Generics question
    ... I am reading through the basics of generics from several different ... and one of the things that is common amongst all of them seems ...
    (microsoft.public.dotnet.languages.csharp)