Slashdot Mirror


Sneak Peak at Java's New Makeover

SadatChowdhury writes "Aside from templates as already reported in a past slashdot article , a little snooping around revealed the details of the following newly revealed features in the upcoming release of Java 1.5 (codenamed: Tiger) : Autoboxing , Enhanced-For-Loop, Enumerations and Static Imports . Must read for Java fans." In related news: jdkane writes "Sun Microsystems delays a much-anticipated Java specification by three months to comply with guidelines designed to keep Web services interoperable. Says Ralph Galantine, group marketing manager for Java Web services at Sun: "We thought that this change was important for the industry, so that there was no conflict between J2EE 1.4 and the WS-I, "We thought it was worth taking out to the summer." It's very refreshing to hear that a big software company is looking out for the industry, instead of just their own."

7 of 114 comments (clear)

  1. Also Concurrency/Memory/Threads/Isolation by LarryRiedel · · Score: 4, Informative

    There are some other interesting changes coming to provide a more coherent memory model, vastly improved concurrency support, and intra-JVM application isolation. Java is getting much better at providing access to the capabilities of the underlying OS, and the JVM working more like a little multi-process OS itself...

    Larry

  2. Happy to see Java gain features. by HFXPro · · Score: 3, Informative

    I for one will like the new features Java is gaining. All too often when programming in Java for school (the main place I use Java), I often find myself wishing and wanting some of the features of C++. I've even gone so far as to write a perl script to allow me to create my own templates and have it convert the template to a proper .java file. Has anyone else resorted to this hack?

    On the other hand, Java still is not my preferred language. C\C++ will probably always be my language of choice. They are what I learned first, what I enjoy programming in most, and which I plan to never quit using. Being able to use several design paradigm's is extremely nice, which is why my other favorite language is OCaml. However, I am still picking up its nuisances so things are subject to changing.

    I would like to know, however, why the professors at my school bash C and C++. I for one can see the weaknesses of the languages, yet I can also find weaknesses in many other languages including the languages of functional and declarative paradigms. I think a lot of their disdain for C and C++ are due to memory management. However, manual memory management has never really been a huge problem with the way I write my code. Anyone else care to respond on if this is an academia thing to hate C and C++ or just my school? Perhaps all my teachers have their heads on tripods just like the people they complain about. Especially since, they do not work to try and improve the current programming languages.

    --
    Reserved Word.
    1. Re:Happy to see Java gain features. by Anonymous Coward · · Score: 1, Informative

      C/C++ are fun and important for many tasks. But you will find especially on large projects that you spend 80% less time hunting bugs using Java instead of C/C++. Part of the reason is that segfault errors can take hours to track down, especially if you're using someone else's code. In Java (and I program it every day) I only run into a bug once every three months that takes me more than 5 minutes to at least understand.

  3. JSR 201 by JWCoder · · Score: 1, Informative

    It didn't take very much digging but in order to save others time who might be looking for it, I found the 'official' JSR for these items:

    http://jcp.org/en/jsr/detail?id=201

  4. What's wrong with a while loop? by Eneff · · Score: 2, Informative

    I mean, you can always do:

    Iterator i = obj.iterator();
    while (i.hasNext()) { ...
    }

    If you need a count, then add it at the top or bottom (depending on need) -- This just seems like syntactic sugar gone awry.

    1. Re:What's wrong with a while loop? by dobratzp · · Score: 2, Informative

      The problem is that i is outside the scope of the loop. However, it is only needed within the loop. If you don't have any other loops in the vicinity, then you are okay, but consider this:

      Iterator i = obj.iterator();
      while (i.hasNext()) { ...
      }
      ...
      Iterator i = obj.iterator();
      while (i.hasNext()) { ...
      }

      Whoops, this doesn't compile. There's a few ways out of this:

      Iterator i = obj.iterator();
      while (i.hasNext()) { ...
      }
      ...
      i = obj.iterator();
      while (i.hasNext()) { ...
      }

      The problem with this is that if you delete the first loop, you have the remember to change the second loop. (This is why reusing variables to do different things is not a good idea.) Here's another approach:

      Iterator i = obj.iterator();
      while (i.hasNext()) { ...
      }
      ...
      Iterator i2 = obj.iterator();
      while (i2.hasNext()) { ...
      }

      The problem with this is that you might forget to change all references from i to i2. Now consider the "standard" solution:

      for(Iterator i = obj.iterator(); i.hasNext();) { ...
      }
      ...
      for(Iterator i = obj.iterator(); i.hasNext();) { ...
      }

      Here, each Iterator is in its own scope and you can easily refactor one loop without dealing with the other.

  5. Re:Yes, although generics != templates by Anonymous+Brave+Guy · · Score: 2, Informative
    Templates were C++'s way of simulating generic types. The difference is that templates are essentially macros in fancy clothing, and generate a different flavor of the class for every combination of type parameters, while generics are a much cleaner, more abstract construct, better grounded in the theory of types, which use polymorphism to achieve their genericity.

    That's one definition of generics, but hardly the only one in use in the programming world. "Polymorphism" is one of those fantastic words that has had so many meanings attached to it that it no longer means anything useful without further qualification. Templates in C++ can do a little more than boring old macros these days, too.

    In any case, this will be a fantastic feature, and they're done a much better job with it than C++ did with templates.

    If you're going to troll, could you please at least provide some sort of supporting evidence? On paper, the Java implementation is similar to C++ templates but with the usual Java trade-off that some of the power is sacrificed to improve the simplicity. However, in this case, that leaves Java generics without several useful features, and consequently without the ability to do most of the useful tricks that leading edge C++ can do. How do you see Java's generics as better than C++ templates, other than being simpler, and using OO-style polymorphism (which isn't really a generics issue, it's a C++ type system vs. Java type system issue)?

    --
    If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.