Want to read Slashdot from your mobile device? Point it at m.slashdot.org and keep reading!

 



Forgot your password?
typodupeerror
×
Java Programming

Preview of Java 1.5 461

gafter writes "An early access prototype implementation of the proposed new J2SE 1.5 language features is available. The prototype includes generics (JSR 14), typesafe enums, varargs, autoboxing, foreach loops, and static import (JSR 201). In other words, all the new language features planned for 1.5 except metadata (JSR 175). The prototype includes full sources for the compiler, written in the extended language. You can download the prototype from java.sun.com. It requires J2SE 1.4.1 and provides some examples of how to use the new language constructs. The prototype includes an experimental type system (variant type parameters) for Generic Java that is being considered for Tiger (1.5) based on a paper by Igarashi and Viroli at ECOOP 2002 . Comments and votes for the new type system are being gathered at bugParade."
This discussion has been archived. No new comments can be posted.

Preview of Java 1.5

Comments Filter:
  • good and bad ...? (Score:4, Interesting)

    by bubzer ( 515336 ) on Saturday May 31, 2003 @04:49AM (#6083438)
    Some of these things are certainly nice (typesafe enums...) - but wouldn't it be nice to try and keep the java language *simple*? There are iterators for doing stuff like foreach-looping ... varargs? Why? It is an object-oriented language - take use of that polymorphism!
    • by IO ERROR ( 128968 ) <errorNO@SPAMioerror.us> on Saturday May 31, 2003 @05:09AM (#6083480) Homepage Journal
      varargs? Why?


      Because no language is complete without printf.


      Anyway, I'm glad to see Java finally getting generics. This will make it a little easier to manage very large projects in Java. The only problem I see is that generic java usually sucks compared to the brand-name stuff (e.g. Lavazza [lavazza.it]).

    • Re:good and bad ...? (Score:5, Informative)

      by bramez ( 190835 ) on Saturday May 31, 2003 @05:26AM (#6083516)
      but wouldn't it be nice to try and keep the java language *simple*?

      isn't syntactic sugaring all about making code more readable? I think boxing , generics, typesafe enums, static imports make the java language more simple to use.

      It's just looking over the fence to the "sibling" languages (c++, c#) and copy what they do better.

      • by Anonymous Coward on Saturday May 31, 2003 @05:45AM (#6083562)
        There certainly is a tradeoff: If a language gives too many options to do one thing, it becomes confusing. A programmer usually develops a certain coding style. She prefers certain constructs over others. When you read code, you have to adjust to the style of the programmer who wrote the code, and possibly recognize constructs which you're unfamiliar with because they're not part of your coding style. Take the proposed for-loop extension as an example. Every Java programmer instantly recognizes the head of an "iterator for-loop". It's an idiom. The proposal adds syntactical sugar to supposedly help identifying this very frequently encountered situation, but it does the exact opposite: There are now two ways of looping over an iterator, and you have to be familiar with both if you want to quickly understand other people's code. If you want a good real-world example of what too much syntactical sugar does to a language, take a look at some Perl programs.
        • There are now two ways of looping over an iterator, and you have to be familiar with both if you want to quickly understand other people's code. If you want a good real-world example of what too much syntactical sugar does to a language, take a look at some Perl programs.

          Ah, but Java's two for-iterator loops are slightly different. The 'foreach' IIRC provides you with a single variale that points to successive items in your collection...it does not provide you an iterator. This means you can traverse the

    • by Daleks ( 226923 ) on Saturday May 31, 2003 @06:01AM (#6083596)
      Some of these things are certainly nice (typesafe enums...) - but wouldn't it be nice to try and keep the java language *simple*?

      Type-safe enums were added to eliminate previously verbose and obfuscated code. It simplifies the code without complicating the language.

      There are iterators for doing stuff like foreach-looping ... varargs? Why? It is an object-oriented language - take use of that polymorphism!

      What does polymorphism have to do with an enhanced the for-loop or variable arity functions? The enhanced for-loop ensures that collections are properly iterated across (no out of bounds exceptions). You honestly think that

      for (int i = 0; i < C.length; ++i) {/* ... */}

      is more complex than

      for (int i : C) {/* ... */}?

      Also look at what you can do with variable arity functions. Say you have a constructor for a collection class and you want to be able to initialize a variable number of default values. Well, now you can. Apple's Cocoa (Foundation) library uses this to allow easy construction of NSDictionary objects.


      id d = [NSDictionary dictionaryWithObjectsAndKeys:@"foo", @"bar", @"biz, @"baz"];


      The other way to do it would have been


      id d = [[NSMutableDictionary alloc] init];
      [d setObject:@"foo" forKey:@"bar"];
      [d setObject:@"biz" forKey:@"baz"];


      Aside from Cocoa's long parameter naming scheme, the first method is a shorter and a lot easier. It also uses fewer messages.
      • Re:good and bad ...? (Score:3, Interesting)

        by __past__ ( 542467 )

        You honestly think that

        for (int i = 0; i < C.length; ++i) {/* ... */}
        is more complex than
        for (int i : C) {/* ... */}?

        In a way, yes. The first uses the (little) possibilities the core language offers. The second uses a language feature that depends on a specific part of the class library.

        So, even if the resulting code itself is easier to read, if conflates two layers of the language that should better be cleanly separated, IMNSHO. It basically boils down to the fact that you cannot change the cla

        • In a way, no. (Score:3, Interesting)

          by Latent Heat ( 558884 )
          for (int i = 0; i is something I understand and can read in an instant. I call this a "C-ism" in that from C to C++ to Java to C# it means the same darned thing, and it occurs so often I don't have to blink when I see it.

          for (int i : C) {}

          or more properly

          for (CMemberType cMem: C) {}

          is something that I have to scratch my head about. The fact that people conflate i with c_mem and confuse a collection member with a loop index tells me that the new construct is going to give problems.

          Yeah, yeah, Law

      • by Admiral Burrito ( 11807 ) on Saturday May 31, 2003 @06:41PM (#6086864)
        Also look at what you can do with variable arity functions. Say you have a constructor for a collection class and you want to be able to initialize a variable number of default values.

        You can already declare arrays in-line. So if they were to define an appropriate constructor, you could do List l = new ArrayList(new Object[] { "foo", "bar", "baz" }).

        That is verbose of course. What they really should do is add collection manipulation stuff to the language, so you could go List l = ( "foo", "bar", "baz" ) and be done with it.

        I believe that that scripting languages get most of their advantages (more functionality with less code, easy to develop in, etc) because they have collections as first-class entities. It's not as if it would be polluting the language... How often do you write code that doesn't use some kind of aggregate data type? For the language to not recognize that is just silly.

    • Re:good and bad ...? (Score:2, Interesting)

      by Dan-DAFC ( 545776 )

      I agree. Enumerated types are something Java has been lacking for too long, so these type-safe enums will be welcome (though Joshua Bloch, the specification lead on JSR 201, has a nice alternative in his excellent Effective Java book).

      I really don't care much about the rest. I'll give the generics and the autoboxing a go, but I don't really like the new for loop syntax. Firstly I think it's ugly, they've compromised to avoid adding a new keyword (I don't really know why, they were happy to add new keywo

      • Re:good and bad ...? (Score:3, Informative)

        by GrayArea ( 69302 ) *
        Built-in support for iteration does not depend on packages other than java.lang, they specifically mention this in the documentation. There is a new Iterable interface in java.lang that the collections implement, so you can make your own classes participate in the same mechanism if you want.

        Cleaning up the core libraries should never mean rearranging them according to some fleeting sense of pure aesthetics. Even a cleaned-up Java has to provide some amount of backward compatibility for existing code. Chan

    • Re:good and bad ...? (Score:3, Interesting)

      by cookd ( 72933 )
      Iterators should not be used to replace the counting case:

      for(i = 0; i < count; i++) { ... }

      You can use iterators for this, but (depending on the implementation) it is likely to be slower, since the object in question must create an iterator instance.

      Iterators should be used (in fact, are pretty much a necessity) on types that are not easily indexed, such as hash tables or linked lists. As long as the Java language doesn't have support for iterators, developers creating non-indexable container class
  • No subject. (Score:5, Funny)

    by Daleks ( 226923 ) on Saturday May 31, 2003 @04:54AM (#6083451)
    <insert some generic unsubstantiated comment here about how some unnamed java applet is slow on my p133 and why this makes me hate java & sun>! But, <insert some generic comment here about how real programmers use c++ and only weenies who can't handle pointers use java>. And finally, <insert some generic comment here about how java is owned by a single corporation and is thus evil>.

    Just had to get that trolling out of the way. Now let the educated and well-formulated arguments begin.
    • Re:No subject. (Score:3, Interesting)

      by Kethinov ( 636034 )
      As a "weenie who can't handle pointers" I take Java's slowness very seriously. I wish that a better method could be used to process Java programs because I believe that future high level programming languages are going to be modeled around Java. PHP certainly is being modeled around Java. Am I the only one here who'd like to some day be rendering serious 3d graphics through Java? I think the language has potential and I don't just shrug off its slowness as an inherent property, I want it to improve in that
      • Of course you can handle pointers!! I'm tired of running into Java programmers who are scared of lower level code (read: C). Get the K&R book and read it start to finish already!! A decent amount of experience programming in any procedural language will make looking at C a lot clearer.

        Java's slowness is an inherent property, sorry. It's just a function of its design, not a flaw. 'Serious' 3D grahics will always be done at a lower level than languages such as Java, if 'serious' means 'state of the art'.

        • Re:No subject. (Score:4, Insightful)

          by DickBreath ( 207180 ) on Sunday June 01, 2003 @01:00PM (#6090361) Homepage
          Of course you can handle pointers!! I'm tired of running into Java programmers who are scared of lower level code (read: C).

          I'm tired of running into C programmers who are scared of lower level code (read: Assembly).

          I'm tired of running into GUI users who are scared to use the command line.

          I'm tired of running into calculator users who are scared of using a slide rule.

          I'm tired of running into automatic transmission drivers who are scared of manual transmisions.

          I'm tired of running into people who use drive automobiles and are afraid to use a horse and buggy.

          In fact, I don't think scared is the issue here at all. The real issue is automation. Something that always makes people more productive, and requires greater machine resources. (See all above examples.) In fact, using your own argument against you, I would argue that anyone here, even a Basic programmer, can learn to program Assembly, use a command line, use a slide rule, etc. In fact many of us were Basic programmers. Many of us do or did these other skills. That fact that you can be "macho" and learn pointers is missing the real issue. Automation.

          In Java, you are trading machine performance for human performance. You simply eliminate the possibility of even having the all of the most common C/C++ bugs that plague so much modern software.

          CPU cost is going down. People cost is going up. This trend has been going on for a long time. (Have you noticed this trend in the past 20 years?)

          Back in the early 60's and 70's there were huge debates about whether "high level" languages (like the C you advocate) would ever be useful because the compiled code was so much less efficient than hand written code. (And yes, I know that argument in the late 70's that compilers would eventually write better code than by hand.) But the point remains, that even if this is or is not true, high level languages won.

          Think about why that is for a moment.

          In any sufficiently complex C/C++ system, you either end up implementing garbage collection, or end up with some complex disciplined memory management strategy, and still end up with object lifecycle bugs. In C/C++ you sometimes end up implementing your own miniature Lisp, even if you've never seen Lisp. But your own implementation of Lisp ends up poorly specified, and not throughly debugged.
  • by Anonymous Coward on Saturday May 31, 2003 @04:56AM (#6083454)
    Surprisingly (!!!) all the things C# had (or will have - generics) that made it superior. This is going to be fun seeing these two compete. So far I am on the C# side but who knows :) this is really fun.
    • by Jugalator ( 259273 ) on Saturday May 31, 2003 @05:15AM (#6083494) Journal
      Yes, I noticed this as well. I found it pretty interesting, and it reminded me of the old IE/Netscape browser wars. One implements the new features of the other. Let's just hope they don't get too carried away and bloat the language. :-/

      To me, Java was a lanaguage with a minimum of "redundant" features. You can write a "for" loop without using "foreach". You can use a class instead of a struct. And so on... I'm actually a bit surprised that Sun are throwing in features the language doesn't really always seem to need. I thought that was C#'s area. :-)
    • My bet would be that C# was developed taken into consideration common complaints about Java - or things that were already planned to be added to Java 'some time in the future'.

      And hats off to Microsoft for doing so, C# is a nice language.

      I agree, however, that the next release of Java will raise a few eyebrows wrt 'fixing' Java's current 'problems' (if you could call them that - they're more like syntactic unpleasantries).

      Should be interesting ;)
  • For years java zealots have told us that features like automatic boxing and templates are dangerous because they hide what really happens.

    Now that java has them too, they are suddenly the biggest thing since sliced bread. Most modern languages have had automatic boxing for ages, and never made a big deal about it.

    And about the new templates: they are just syntactic sugar. For example if you have an ArrayList, the elements will still be stored on the heap as Integer objects. That is very inefficient.

    And w
    • by Anonymous Coward
      And what about VM sharing? Will it be in java 1.5, or will we still have to wait 30 seconds for java programs to start up?

      mod up. this is major pita that makes java almost unusable for small&trivial stuff. (ironically - the stuff it was designed for)
      • It's correct to say that the start-up time for JVMs is a concern (more so than actual Java execution speed) but fortunately things are getting better in this respect. Java 1.4.2 (which is in beta at the moment) has made some significant improvements in this area.

    • "Progress doesn't come from early risers - progress is made by lazy men looking for easier ways to do things.(R.Heinlein)"

      A lot of the features added to 1.5 are syntactic sugar for laziness. I guess that means this is true progress, according to your signature.

    • While reading some Java discussion forums, I came across a thread with someone reporting a new comment on the shared VM bug in bug parade. The comment indicated that Sun wasn ot going to plan on having shared-VM in the 1.5 release of Java.

      This immediately sparked a campaign of, well... complaining. But it seems to have worked. In a matter of hours, the comment had disappeared.

      Now, I still have no positive evidence that Sun WILL put shared-VM into 1.5, but at least subtle, but solid evidence that they d
    • by Call Me Black Cloud ( 616282 ) on Saturday May 31, 2003 @07:31AM (#6083753)
      I believe one of the things Sun tried to get at was to make Java development easier. It's something they're working on across the board, as this article [internetwk.com] notes.

      Without seeing (in the Java source code) how the templates are implemented I can't say that I agree or disagree with your statement that they will be inefficient, though I'm inclined to disagree based on your example. Templates or not, objects are going to be stored the same way. The difference is how those objects are retrieved. Right now you have to cast everything coming out of an ArrayList (unless the Object reference is sufficient)...not only is that being moved to the language but you also gain compile-time type checking. That will only serve to reduce errors and make the software more reliable. Templates are optional anyway - you don't have to use them. I'm looking forward to them.

      I don't think you're ever going to see VM sharing. If applications can share VMs then one rogue app could bring down other apps by trashing the VM (never supposed to happen) or by poor thread management.

      Either way you look at it, it's a good year to finally be going to JavaOne...
      • by mrright ( 301778 ) <rudi AT lambda-computing DOT com> on Saturday May 31, 2003 @07:54AM (#6083793) Homepage
        "Without seeing (in the Java source code) how the templates are implemented I can't say that I agree or disagree with your statement that they will be inefficient, though I'm inclined to disagree based on your example."

        Slashcode swallowed some brackets even though I was in text mode :-(

        What I mean is the following: If you create for example an ArrayList of ints, the most efficient way to store these ints internally would obviously be an int[] and not an Object[]. But even though java uses templates, it still stores primitive types such as int in an Object[], so there is a huge temporary object creation overhead. Whenever you store an int in your IntArrayList, a new Integer object is created on the heap and an old Integer object has to be garbage collected. In .NET you just store a 32bit value in an array, which is a single operation on most processors.

        The .NET templates will create a different class for each primitive type, so that primitive types will indeed be stored in their corresponding primitive arrays without creating objects on the heap. For classes, the .NET implementation behaves similar to the java implementation: There is only one internal class created for all reference types.

        "Templates or not, objects are going to be stored the same way. The difference is how those objects are retrieved. Right now you have to cast everything coming out of an ArrayList (unless the Object reference is sufficient)...not only is that being moved to the language but you also gain compile-time type checking. That will only serve to reduce errors and make the software more reliable. Templates are optional anyway - you don't have to use them. I'm looking forward to them."

        Me too. It is not that I dislike the new features. I just think that they could have been implemented better, faster and earlier.

        "I don't think you're ever going to see VM sharing. If applications can share VMs then one rogue app could bring down other apps by trashing the VM (never supposed to happen) or by poor thread management."

        VM sharing does not mean that all java programs must run in one process. But for most desktop applications this would make a lot of sense. You are right about the thread management, but you could always restrict the number of threads an application can create. Just have a nice XML file which describes how much resources each application may allocate. That is the way .NET does it, by the way.

        If sun will not do VM sharing, you will never see decent client applications written in java. Just think about it: for each java application you start, the whole swing library has to be JIT-Compiled anew. What a huge waste of processing power!
    • by Baki ( 72515 )
      Generally, I'm sceptic towards syntactic sugar (such as operator overloading, or even overloading in general). However, if you call generics syntactic sugar, you don't know what they are or what you are taling about.

      Sure, its implementation may be in terms of what already exists (i.e. internally you still have Lists of Objects, being cast into Integers or whatever). However, the burden of typecasting is removed from the programmer into the compiler, which is very significant and not syntactic sugar at all!
  • Simplicity lost (Score:5, Interesting)

    by abies ( 607076 ) on Saturday May 31, 2003 @04:59AM (#6083460)
    While, as a java developer, I'm looking forward to most of these changes, I'm a bit afraid that java may lose it's positions as simple OO language which can be used for teaching in schools. Java was originally built with idea that you can read every java program in the world without problems. A lot of expresive power was sacrificed because of that - most notable preprocessor (to avoid people designing their own 'languages' for each project and library, as it is done in C).
    Anonymous inner classes was first major ugliness which came into language - not very clear, hard to explain to a newcomer. But with all these new proposals, significant complexity is added to code in terms of visual overview. This is not critical for developers - perl hackers are faring very well, despite of having language 10 times as complicated as java as far as syntax is concerned - but pure-OO, java-is-new-pascal-for-algorithms academic society will probably start looking for a new language soon... (ok, maybe not really 'academic', I'm thinking more about secondary-level school programming basics).
    • Re:Simplicity lost (Score:5, Insightful)

      by girl_geek_antinomy ( 626942 ) on Saturday May 31, 2003 @05:16AM (#6083495)
      It's interesting that you say that about teaching, and I think you have a point. I'm a CS student at Cambridge University (currently avoiding finals revision) where Java is the fundamental teaching programming language, the one they teach you right up front, the examples language for code fragments in algorithms situations (well, along with ML) etc.

      Actually though I think for this kind of teaching you can just use the simple subset of Java that's been about since 1.1 - after all, you're teaching principles of programming and OO - you can teach actual Java *development* down the line and cover the complexities, bells, whistles and dongles then...
      • by ausgnome ( 650653 )
        Oh for the good ol days when pascal was the teaching language
      • I agree. I'm a PhD student at Cardiff Uni and I've spent a lot of time teaching Java to undergrads, some of whom have limited programming experience. It was once a beautiful teaching language, but every new version of the language makes it harder and harder for beginners.

        Don't get me wrong, I also code Java and I love the new features; the trick, as you say, is to focus on teaching a subset. Nevertheless, I await with dread the point next semester when a student points to a piece of example code with an in
        • Next term try teaching them Python instead.

          Then, when they understand the concepts, you can introduce them to the syntactic nightmare that is Java.
          • I've thought of this, and I'd love to, but as a lowly PhD student I find it difficult to change the primary teaching language of a 700-strong computer science department. When I'm king of the world, I'll add it to my ToDo list.
          • Oh, and I don't regard Java as anything even close to a syntactic nightmare. But then again I do a lot of Perl so I have a warped perspective.
          • Any language that uses whitespace syntactically is TOTALLY unsuited for teaching.

    • But do you have to use all the new complex features?

      Besides, if the answer is that you must use these new features or doing X isn't easy, might that not suggest the new feature has made life simpler for developers?
    • by BitwizeGHC ( 145393 ) on Saturday May 31, 2003 @06:26AM (#6083641) Homepage
      Those two languages are far simpler, and let you really hammer the points about programming down without getting the kids confused about syntax rules.

      Smalltalk has, essentially, only one operation: the message send. Send object X a message Y, and get Z back as a result. Even simple things like addition are implemented this way. While not blazingly fast (except in certain specialized implementations), the message-send semantic is surprisingly efficient: many complex real-world systems have been constructed using Smalltalk.

      Scheme also enjoys the advantage of being small and simple, yet powerful. You don't need to know what the lambda calculus is to see how effective and intuitive Scheme's procedural semantics is. ("Lather, rinse, repeat." See? Tail recursion. It was there all along.)

      Either way, it's better to use a simple language to teach students how to formulate plans for doing things (i.e., algorithms), and then hit them with fanciful syntax later rather than drop them into a popular, but bewildering for newcomers, language (which I consider C++ and Java to be).
    • by bj8rn ( 583532 )
      Maybe it's time for some free software JVM to take the 'reformed' (protestant?), less bloated path, while remaining compliant with Sun's Java (with all the bells, whistles and shiny bits)?

      (Click 'Reply to This' to comment about no/no open standards etc)

      ---

    • Oh no! (Score:4, Funny)

      by Julian Morrison ( 5575 ) on Saturday May 31, 2003 @08:48AM (#6083893)
      A language which tons of people use for real apps and business critical stuff might become slightly less useful for academia! Panic, panic!

      Er. Or, not.

      Teach basics in python, algorithms in ocaml, bit-grinding in C.
  • by smittyoneeach ( 243267 ) on Saturday May 31, 2003 @05:02AM (#6083465) Homepage Journal
    You could troll and say that Java has finally caught up with where C++ was better than a decade ago.
    More constructively, maybe the implementation will improve on things from all that time and experience.
    Java is the best defense against the .Net onslaught. Good luck, Java.
  • Generic Java (Score:5, Informative)

    by Darkforge ( 28199 ) on Saturday May 31, 2003 @05:10AM (#6083482) Homepage
    If you, like me, didn't know much about generics, the best place to go to read up more is the specification off of which JSR 14 was based: GJ: Generic Java [unisa.edu.au]. Don't bother with the FAQ though... it seems to be mostly empty.

    (Excuse my whoring, but Sun's link to GJ was 404.)

  • Java is passe (Score:2, Interesting)

    by 73939133 ( 676561 )
    I've pretty much stopped using Java. Sun has broken their promises when it comes to making Java an open standard (and, in fact, they have several patents on core Java technologies). And technically, even with these additions, Java 1.5 is still behind C# in several important areas (native code/data interfaces, genericity, support for numerical computations).

    Also, after trying to live with it for years, I have concluded that "100% pure Java" just doesn't meet my needs. "99% pure" is good enough for me: it
    • I expect Java will continue to survive in some niches (most notably, bloated web services implementations)

      I was about to install Java + JBoss + Tomcat + Apache httpd (and maybe Apache Cocoon) and see what I can do with it. I'm not a seasoned developer (just had a few classes a few years ago), so I'm trying to figure out the best way to offer a scalable web platfrom mainly for database entry and reporting without much custom programming. I'm also interested in application services, but that's more into the
      • Well, first of all, saying that Java (J2EE, really) gives you "bloated web services" isn't the same as saying "don't ever use it". Bloated, complex systems sometimes are the best available solution, and they are great for making money as a consultant or programmer.

        But, in any case, there are lots of alternatives. I suspect that for most applications, you are probably better off using PHP, mod_perl, mod_python, or maybe Zope.
    • Re:Java is passe (Score:3, Informative)

      by waaah ( 677720 )
      If you don't know anything about it SHUT UP!

      Java:
      -Java as a language is not a standard but doesn't change much at ALL.
      -Every API is developped through the Java Community Process .NET:
      -C# + CLR is standardized (yes only a language and a VM)
      -Other API's are NOT standardized and are in full control of Microsoft

      I think that mono will have some major problems in the future. Sure they can implement C# and CLR, but they virtually have to reengineer all other API's, because there are no formal specs available.
      • Re:Java is passe (Score:5, Insightful)

        by 73939133 ( 676561 ) on Saturday May 31, 2003 @06:57AM (#6083693)
        Other API's are NOT standardized and are in full control of Microsoft [...] I think that mono will have some major problems in the future. Sure they can implement C# and CLR, but they virtually have to reengineer all other API's, because there are no formal specs available.

        How is that different from C++ and the Win32 APIs? The fact that Microsoft controls the Win32 APIs doesn't matter to me when programming in C++--I just write my code in Gtk+ or wxWindows. Likewise, the fact that Microsoft controls the .NET APIs doesn't matter to me when programming in C#--I can just use Gtk#.

        Furthermore, you don't need Sun-style central control over everything in order to get good cross-platform toolkits, as toolkits like Qt, FLTK, and wxWindows show. C# will have good cross platform support, either by successfully cloning .NET, or by binding to an existing cross-platform toolkit, or by creating a new cross-platform toolkit just for C#.

        You see, the fact that C# doesn't come with philosophical baggage like WORA and "100% purity" is an advantage as far as I'm concerned. What WORA and "100% purity" has brought us is lousy implementations of Java on Linux, and APIs that don't even let me access environment variables.
  • Generics (Score:5, Interesting)

    by The Bungi ( 221687 ) <thebungi@gmail.com> on Saturday May 31, 2003 @05:29AM (#6083525) Homepage
    There's an apropos article [kuro5hin.org] over at kuro5hin. Well written, I think.

    It seems to me that languages like Java and C# really don't need them.

  • by Kjella ( 173770 ) on Saturday May 31, 2003 @05:36AM (#6083544) Homepage
    ...because there's nothing like running a 2kb calculator and a 2kb notepad and both have them run on separate 10-15mb VMs. That is a real drag for any non-monolithic use of Java (yes I do know of servlets etc.)

    Kjella
  • JSR 201 says nothing about "varargs".
  • Dylan (Score:3, Interesting)

    by oodl ( 398345 ) on Saturday May 31, 2003 @05:56AM (#6083585)
    Sounds like they are adding a lot of features that the Dylan programming language has had since it's release (approximately 1995).

    But whereas the features were elegantly incorporated into Dylan since the beginning and are consistent and easy to use, I suspect that in Java they are a hack.

    Wasn't Java designed to be a simple language?
  • by BjornStabell ( 579718 ) on Saturday May 31, 2003 @06:27AM (#6083642) Homepage

    These additions seems to put Java on par with C#, but to make a quantum leap in expressiveness you need a dynamically typed scripting language.

    Most applications these days can be written in higher-level languages, resulting in 5-10 times less source code compared to Java/C#, and making them correspondingly simpler to code and maintain.

    Java doesn't really have a kick-ass companion scripting language. In MS world, VB plays this role. VB is really popular, but (I think most people would agree) a crap language and not really that high level. JavaScript just doesn't seem to cut it (pretty much only used in browsers).

    Why doesn't Sun take a hint and phase JavaScript out in favor of a powerful multi-purpose high-level language like Python [python.org] or Ruby [ruby-lang.org]? That'll put them miles ahead of Microsoft in terms of increasing programmers' productivity... and programmers' quality of life.

    • by Billly Gates ( 198444 ) on Saturday May 31, 2003 @07:09AM (#6083715) Journal
      " Most applications these days can be written in higher-level languages, resulting in 5-10 times less source code compared to Java/C#, and making them correspondingly simpler to code and maintain."

      Look here [com.com] for more info. My guess is Sun is brewing something with the next edition of SunONE and Forte. Notice how Sun is targetting there new tool at VB users.

      Its possible these features were added to java 1.5 so Forte can have a VB like ide to generate java code easier. After all, enums make things easier to read and are essential for new programmers to read your code.

      Competition is great and I believe a great RAD and ide that is based on a fairly good langauge will give .net some tough competition. Its this ability that has attracted alot of attention towards .net.

    • by MSTCrow5429 ( 642744 ) on Saturday May 31, 2003 @08:07AM (#6083814)
      JavaScript has nothing to do with Java, other than their similiar names. JavaScript, originally LiveScript, "was renamed by Netscape marketers who licenced the name to ride Java's Buzz" (Wired, July 2002, pg. 61). Javascript is actually an offshoot that sprung from both C++ and ANSI C (C89). JScript and ECMA Script sprung from Javascript.
      • JavaScript is a scripting language. Microsoft's .NET framework includes bindings to one low level languages (C#), one mid level language (VisualBasic), and one scripting language (JavaScript). If you pick up Visual Studio, you get bindings for J# and C++, too. Plus, lots of people are looking forward to F#, a functional language.

        The point is that Sun really hasn't endorsed any alternative bindings to the Java platform. They certainly haven't endorsed any dynamically typed "scripting" languages similar
    • Actualy, try looking at Jython [jython.org]

      Sure, for small programs its not perfect (as you'd have to still run the VM), but this way you can integrate Java applications and use Python to script these applications.
    • by DdJ ( 10790 ) on Saturday May 31, 2003 @10:13AM (#6084199) Homepage Journal
      Java doesn't really have a kick-ass companion scripting language.
      Have you looked at BeanShell? I haven't started using it yet, but it looks like it has the potential to really empower scripting.
  • by Fuzuli ( 135489 ) on Saturday May 31, 2003 @06:54AM (#6083689)
    Ok, let's all try to see how Sun can be incredibly stupid.
    You have a company that has a strong position in the Enterprise, and you have a technology that is pretty much accepted. Meanwhile your opponent is busy with conquering the desktop since it can't provide solutions strong and stable enough for the enterprise. What in god's name did you think MS was going to do? Was Bill Gates supposed to turn the others in the room and say "hey this was fun, let's do it again!" after MS has owned the complete desktop ? OF COURSE they'll try to dominate the Enterprise too!! .NET was announced almost 3-3.5 years ago. Sun saw it coming and did nothing. Bitching about how MS products sucks is not the solution. You should have used your advantage and experience in the Enterprise instead of letting MS slowly steal it from you. If Sun could have cared for what the industry has been complaning about in their technology, and implemented the necessary changes, by the time .NET is out, it would be just a ripoff. But look what we have here now: Sun, is trying to catch up with MS in the field where it had for years. You have a huge user base, you have a mature technology, why do you wait for opponents to catch up ? Java is not dead yet, but it's not hard to see why it'll be dead at the end, when you look at what Sun is doing..
  • Java Vs .net (Score:5, Insightful)

    by tonywestonuk ( 261622 ) on Saturday May 31, 2003 @07:25AM (#6083741)
    To be quite honest, I dont care at all if .net is better than Java. The point is that .net is controlled by Microsoft, and currently only runs (officially) on M$ products. Mono might be outlawed by Microsoft at any point. You are at their mercy.

    The ONLY reason that Sun hasn't relinquished control of Java, is that if they had done so, Microsoft would have been free to embrace/extend/ corner the market.... The same as what they did with Internet explorer.

    So, how many non-geeks use anything but, or even know of anything but IE?

    Businesses would standardise on MS java, and java on any other platform would become unuseable.. (just as there are web pages that are only useable in IE).

    By stating "I'm using C# over Java" you are selling you sole to the devil...You wait till microsoft start extending DRM into the specification, therby relegating projects like Mono to the sidewalk, at this point it will be M$ .net, or nothing. Do not think this will not happen.

    So, Its your choice. Choose to go with the, arguabily faster/easier to code offering by our (sarcasm) good friends at Redmond, or choose to fight Microsoft by writing code that will run on all platforms from mobile phones to IBM mainframes. Believe me when I say we will all be better off in the long run.

    • Re:Java Vs .net (Score:5, Interesting)

      by Billly Gates ( 198444 ) on Saturday May 31, 2003 @07:35AM (#6083763) Journal
      Speaking of mercy and fud responses from the pro .net/mono crowd you can always mention the SCO effect. Corporations obsses with legal costs and potential lawsuits. Company Image is not something that is easy to get back if its hurt. This is important when picking a solution

      Most major corporations who are planning on moving to Linux if they have not done so are cancelling and puting their plans on hold thanks to SCO.

      If you use mono at work assuming its mature enough and ms pulls a sco you can kiss your linux workstation goodbye.

      According to MS halloween documents, legal fud got a negative response form %80 of all bussinesses.

  • More Wrong Choices (Score:5, Interesting)

    by ChaoticCoyote ( 195677 ) on Saturday May 31, 2003 @08:00AM (#6083804) Homepage

    I program Java for several customers, from scientific to business apllications.

    Autoboxing is yet another way of hiding overhead; the wrapper classes still exist, but are now a big "secret" masked by autoboxing.

    Why add autoboxing to make containers look more "natural with POD types, then ignore the crying need to operator overloading in scientific and engineering applications? Why one piece of syntactic sugar as opposed to another?

    Overall, I'm not terribly impressed. The new generics seem weak; I don't see an emphasis on fixing bugs, stability, or independent standardization. Much as I like Java, 1.5 does not address most of my needs.

  • by anonymous cupboard ( 446159 ) on Saturday May 31, 2003 @08:48AM (#6083898)
    We see yet another evoloution of Java, another run-time-environemnt, each of which is subtly incompatible with the rest.

    I am working with a large bank at the moment, one of the largest in the world and they have largely junked Java, except for running browser applets.

    They liked Java, the class libraries were great but, sorry, it is too slow. I'm not talking about incompetent coders. They even had Sun in looking at some of the apps. The end result was a customised virtual machine - but it was still too slow and the incompatibilities were a killer. The VM had to work identically across the bank's generations of systems from different vendors. One gotcha, IIRC, was synchronisation, making it difficult to run a JVM across processors and to exploit them properly for performance.

    End result was a switch back to C++ for back end apps. Java could still be used but only for non-critical front-end stuff. The bank may consider C#, but it seems that Java has had its day.

    Maybe this sounds like a troll, but Sun should release their control of the Standard. This will slow things down, think how long it takes to get stuff into C++, but that stability gives everyone room to think as to whether a change is really necessary.

    I don't like the idea of C# but at least MS handed it over to ECMA.

    • by bokmann ( 323771 ) on Saturday May 31, 2003 @10:54AM (#6084422) Homepage
      I'm tired of hearing that 'java isn't used in real-world applications", then some stupid example touted as proof. Java is used in plenty of real-world scenarios. The U.S. State Department [ndf.org] uses java, and so do a large number of countries around the world to aid in the export control [trackernet.org] of nuclear, chemical, biological, and other hazardous materials.
    • Java is not the fix for all code projects. No language is.

      I don't like the idea of C# but at least MS handed it over to ECMA.

      Microsoft has handed C# to the ECMA, not .NET.

      The language is insignificant compared the the framework, that is the large set of APIs, libraries, documenation, and endorsements that come with the language.

      C# being offered to the ECMA is a marketing ploy.

      Look at ECMAScript. It's a standard isn't it? Now how come we still have to be careful which browser we're in when we write

  • ENUMs, yay! (Score:3, Redundant)

    by mekkab ( 133181 ) on Saturday May 31, 2003 @09:04AM (#6083937) Homepage Journal
    Shoot, my list of "things I would change about Java if I actually got off my ass and did something instead of complaining all the time" just got 1 entry shorter!

    What am I going to bitch about now?!
  • by Julian Morrison ( 5575 ) on Saturday May 31, 2003 @09:05AM (#6083940)
    ...for getting less simple, but it was never simple to begin with. Simple would be to use weak-vars-strong-values typing like python. Making everything an Object and using that plus typecasts to do generics is not "simple", it's a hack. It uglifies your code, makes it less efficient, and (ironically) breaks strong typing.

    Generics are also a hack, but at least they are an overt, clean one.
    • The way generics are implemented in Java might be a hack, but parametric types are a very sound mathematical construction (see type theory, category theory, etc). When implemented correctly in a programming language, they can:

      1. improve programmer productivity
      2. improve quality of code
      3. improve efficiency (speed/space) of developed software

      However, I am sure Java's generics are nothing more than heavy syntactic sugar. Still, anyone who complains about generics in Java doesn't know very much about progr
  • by ggruschow ( 78300 ) on Saturday May 31, 2003 @09:09AM (#6083954)
    So many of the posters here are missing the best reasons to use Java today. Java is highly pragmatic. It's a good, broad set of tools that's widely understood and supported, and often improved.

    Java rarely wins in any particular niche. Relatively simple GUIs and COM objects are owned by VB (and Delphi). C++, C, and assembly rule in performance. Perl rules text processing. Python rules in ease of reading. ANSI C, Perl, Python may be more portable. Smalltalk, Eiffel, Lisp, Ruby, ML, Haskel, Forth, and a variety of others are a lot more true to a pure language concept. However, Java does an adequate job in most cases, and when you start crossing boundaries, it'll often be easier to do so in Java-land.

    Java isn't innovative. However, it's constantly being improved. Sure, things like JDBC, Collections, SWING, NIO (async I/O), generics, threads, and concurrent garbage collection were available in some form elsewhere previously. They're all packaged into nice, free, portable, well documented, easy to use parts of Java though, and I'm happy to have them.

    Java isn't as free as Emacs. However, it's mostly free as in beer, and it doesn't force it's freedom on you. It's certainly a whole lot freer than most things from Redmond. I admit, I don't care if a language is handled by a standards body, unless the company in question holds other monopolies it can abuse. I seriously don't think Sun is going to do anything so wacky as polluting the language to make COM (*cough* MS) or Object Pascal integration (*cough* Borland) easier.

    Java's support base and (free) developer tools are just plain great. I love Eclipse, and IDEA and recent JBuilders are pretty nice too. VS.NET is good stuff as well, but contenders like Python are sorely lacking in this arena.

    I still write plenty in other languages, but every year the percentage I write in Java goes up.. They keep filling holes (soft references, regexes, async I/O, .1s GC pauses) that were keeping me out of Java. I'm happy to see some more syntatic sugar in Java.. The things they're addressing will make a whole lot of code more readable.

  • iteration (Score:3, Interesting)

    by jefu ( 53450 ) on Saturday May 31, 2003 @12:35PM (#6084907) Homepage Journal
    While most of these changes are quite positive, I think the iteration mechanism still could use some changes. Most simply, along with :
    for (int i : C) {... }
    also allow :
    for (int i : C.iterator) { }
    so that iterators other than the default (the SimpleIterator named "iterator") could be used.

    This would not complicate the iterator syntax much and would make using different iterators easy - and thats something that is often needed.

    Since the "C" above is an expression, it could be a function that returns an "Iterable" - allowing interesting hackery to provide alternate iterators using inner classes or other fun. However while I think this allows programmers to do about what they need, it does not make things exactly readable and that is a bit bothersome.

    Another thing I'd like, and would like to have efficient and easy to use, is a way to iterate over the indexes of an array - in particular a multidimensional array. I get tired of doing things like the following (which I can't get to indent easily) :

    for (int i = 0 ; i < ilim ; i++)
    for (int j = 0 ; j < jlim ; j++)
    for (int k = 0 ; k < klim ; k++)
    b[i][j][k] = a[i][j][k] + 1

    It would be much easier to do something like
    for ( (i,j,k) : a.indexes) { ... }

The Tao is like a glob pattern: used but never used up. It is like the extern void: filled with infinite possibilities.

Working...