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

 



Forgot your password?
typodupeerror
×
Java Programming

Java 1.5 vs C# 790

SexyFingers writes "Sun released Java 1.5. The non-API stuff that they've added made it finally "catch-up" with C# - since both languages are built to support OOP from the ground-up, their constructs become almost identical as additional OOP "features" are supported. So if you're doing C# and your foundations in OOP are rock-solid, there really isn't any difference whether you're coding C# or Java."

Here's the list of enhancements to the Java Language:

  1. Generics (C# 2.0 already supports this)
  2. Enhanced For-Loop (the foreach construct in C# 1.0, duh!)
  3. Autoboxing/Unboxing (C# 1.0 already has this, everything is an object, even the primitives - not really, but they do it so well...)
  4. Typesafe Enums (again C# 1.0 already implemented this, but I think they've added a little bit more twist in Java, that its actually a better implementation)
  5. Varargs (C# 1.0's params construct, ellipsis construct in C++)
  6. Static Import (I don't know if C# 1.0 has this, or C#2.0, but C# has a construct for aliasing your imports - which is way cooler. Static Import, actually promotes bad coding habits IMHO)
  7. Metadata/Annotations (this is C# 1.0's Attributes, Sun's upturned noses just gave it a fancier name - also, C#'s implementation is better and more intuitive)

They've beefed up the API some, and integrated several packages with the regular JSDK that used to be a part of a separate package or installation ---in my NSHO, the Java API has become bloated...

At this point (even before Whidbey) the deciding factor (as always) for Enterprise work, when choosing a language platform, should be the support it has behind it, in terms of IDE, tools, api, and longevity of the vendor pushing it (forget the OpenSource crap argument, those guys are too in love with Perl, Python, and Ruby - Java could become the child nobody wants to talk about if Sun dies) - right now that's C# and the .NET Framework ---

If you ask Paul Graham though, both language would be utter crap and fit only for idiots :) http://www.paulgraham.com/gh.html [I'm exaggerating, so hold off on those flames.]

This discussion has been archived. No new comments can be posted.

Java 1.5 vs C#

Comments Filter:
  • by carpe_noctem ( 457178 ) on Monday October 11, 2004 @11:36AM (#10494240) Homepage Journal
    ...and let me tell you, java doesn't have to do that much to "catch up" to it.
    • by LnxAddct ( 679316 ) <sgk25@drexel.edu> on Monday October 11, 2004 @12:13PM (#10494727)
      I code in java on the side for some small business apps. I've also coded in C# and have used all of the MS Visual Stuido nonsense. Both languages are at a level that you can do just about anything with one that you can do with the other. So the deciding factors come down to really which is a better platform to develop on and cross platform compatibility (in some cases the latter isn't an issue, but it is for me). As far as IDE's go,I don't get what people like about Visual Studio, especially VS.net. I enjoyed VS 6.0 much better the VS.net, regardless I have since moved to a strictly open source platform and only use Windows for testing. When I did do C# coding, I preferred using vim or Sharpdevelop. I really can't stand VS.net. Anyway, Java, imho, has superior IDEs (some may argue that IDEs reinforce bad programming, etc..., but if used *correctly* they can significantly increase productivity) Eclipse puts Visual Studio to shame in many areas. Eclipse is an amazing IDE and made programming fun again. Another great IDE for Java, that puts great focus on GUI dev, Web App dev, and Mobile phones, is Net Beans. Both IDEs have very nice integrated features with a great tool selection and good plugin frameworks. I use both interchangeably depending upon specific tasks and projects. So in my oppinion as far as having a good platform to work on, Java is superior. Next is cross platform compatibility. Although Mono is making leaps and bounds, Java wins hands down on this. It gives my customers more options and major open source software foundations like the Apache foundation actively work on many java based enterprise applications. This allows my customers to also have low start up and implementation costs.No real need for further discussion on that. Another area where I prefer java is for distributing applications via WebStart. It makes life very easy, in many areas including maintenance and deployment. This is just my 2 cents. I don't really see why anyone would use C#, I mean they took Java and improved, and now Java has taken both its past and C# and improved itself :/
      Regards,
      Steve
      • C# vs Java, mostly a tie (c# good: ref and out parameters, indexers, foreach; c# bad: properties, operator overloading)

        c# library vs Java library: c# is much cleaner in some aspects.

        VS.net vs Eclipse: no contest, VS.net is much worse.
        • by cakoose ( 460295 ) on Monday October 11, 2004 @02:15PM (#10496053) Homepage
          C# vs Java, mostly a tie (c# good: ref and out parameters, indexers, foreach; c# bad: properties, operator overloading)

          While 'ref' paramters are debatable, 'out' parameters are stupid. They should have created a way to return multiple values from a function. Allowing first class tuples would have been the correct way to do this (in most C-style languages, tuples are allowed as arguments to functions and disallowed everywhere else). Adding tuples would also have eliminated the need for the hacked up delegate functionality. Then again, Java doesn't have any equivalent functionality, so it could be seen as an advantage for C#.

          Operator overloading is a good thing. It can be abused, but so can anything else. Removing operator overloading doesn't even come close to making it impossible to write obfuscated code. There are many situations where operator overloading makes things a lot simpler.

          Properties are also good. Instead of identifying them through string matching ("get*", "set*"), language-level support for properties allows more accurate data type modelling. In the end, however, the CLR doesn't really have true support for properties. They implement them as methods (like Java, except at a lower level so most programmers don't have to care about it). This implementation mistake resulted in different opcodes for field access and property access, which means you cannot switch between fields and properties without changing the class's public interface (and breaking binary compatibility with client code). It's still better than what Java does...

          Function pointers and anonymous functions. This has got to be the biggest improvement over Java. Unfortunately, class libraries were already designed before the anonymous function feature so they probably wont be designed to take advantage of it. Also, VB and C++ are probably holding things back because, as everyone knows, "language agnostic" is just a euphemism for "lowest common denominator".

          You also forgot generator functions. They make it easier to write pull-style classes (a "pull" XML parser, for example). Though it isn't as powerful as full-blown continuation support, I think it'll still be useful for many coding tasks.

          C# has more comprehensive generics support (aside from variance). Though both languages made the mistake of allowing arrays to be fully covariant (ArrayStoreException), Java got screwed when they decided not to maintain dynamic type information for generic type parameters. This limits the use of generics in often confusing ways. Type erasure isn't a problem in languages that have a good enough type system to avoid resorting to dynamic typing (like ML or Haskell). But C# and Java do not have good enough type systems and the C# people recognized that and chose to keep the dynamic type information around.

          C# is better than Java in almost every way. Java has better enums and support for covariant and contravariant generic type parameters, but that's about it.

          • Operator overloading (Score:4, Informative)

            by evilpenguin ( 18720 ) on Monday October 11, 2004 @06:25PM (#10498366)
            Say Amen!

            Just because operator overloading can be used for evil is no reason to throw the baby out with the bathwater.

            Java lacks a Currency class, so I wrote a Money class some time ago that I use for common financial calculations, and it takes care of the pesky problem (and newbie mistake) of using floating point types for money.

            BUT, in Java, you have to have add(), sub(), mult(), and div() methods. Reading RPN style caclulations consisting of sequenced and nested method calls instead of algebraic operators is painful. Operator overloading is wonderful in those cases.

            Operator overloading certainly can be evil: What does it mean to increment an Employee? Do I really want to know? But for new types that you can actually do algebra with, it is quite helpful.

            And there are other cases.

            In my C++ days I wrote a FileHash class that kept an index of offsets to the start of each text line in a text file. Then I overloaded the array subscript operator so that a text file could used like an array of char pointers (or a String class if you liked). That was a perfectly good use of overloading.

            Moreover I think overloading the array subscript on ordered collections also makes perfect sense.

            I often wish Java had this feature. I agree with every simplifying choice they made except this one.
    • by GCP ( 122438 ) on Monday October 11, 2004 @04:50PM (#10497508)
      And I was a member of one of the JCP expert groups that brought you Java 5.

      java doesn't have to do that much to "catch up" to it.

      Stated another way, Java 5 is still behind C#, to which I would agree.

      As to how far behind, that depends on what you value. Java's event handling/callback design is atrocious compared to the convenience of delegates. I would much rather pass a single method called OnAccountOverdrawn()to the event notifier than the Java style of making the whole class an instance of some interface, implementing stubs for all the useless methods of the interface, then implementing the one useful method--which will have a useless name like DoAction() that you can't change, then passing the object that contains the DoAction() method to the event notifier.

      And for many things such as generics, autoboxing, enums, etc. (I don't recall which ones specifically), there are actual semantic differences in the virtual machine for C#, whereas Java's knockoff versions are just syntactic sugar for the writing out the equivalent source code yourself. I AM in favor of syntactic sugar, but having the actual semantics available in the underlying runtime gives you additional advantages.

      Java's great advantage is its ubiquity, which is also an impediment to improvement. Sun's position was that it was pretty much finished with language improvements after Java 1.1 and would thereafter concentrate on libraries that would run on existing JVMs. New JVMs might run the code even better, but the old JVMs would still run it.

      Microsoft knew they had to do better, or nobody would switch. They did a lot of things better, and they seem committed to doing more, even if it means obsoleting their existing VMs. They have far more control over The (One) Platform and seem quite willing to make improvements to C# and the other .Net technologies that will require a VM upgrade.

      One catgegory of improvement they seem interested in is a way to make dynamic languages, like Python or Lisp, work REALLY well. Another is support for functional languages like Haskell or OCaml that have special needs of their own.

      And if they do it well, (my speculation now), they could even add some of the attractive features of those languages, languages I like more than C#, to C#, widening the gap with Java.

      Java might have a very hard time keeping up with C# improvements while anchored to existing runtimes, and letting go of the anchor would seriously impact its ubiquity, which is one way in which Java is vastly better than C#.

      I don't think it's a given that Java is going to catch up to C#. But if Mono and/or DotGnu don't succeed, it may not matter as Windows fades away (which I believe it will).
  • Varargs? (Score:5, Funny)

    by American AC in Paris ( 230456 ) * on Monday October 11, 2004 @11:37AM (#10494252) Homepage
    That sounds like it should be some Adams-esque race of semi-competent space pirates...
  • All in it together (Score:5, Interesting)

    by Doc Ruby ( 173196 ) on Monday October 11, 2004 @11:37AM (#10494254) Homepage Journal
    How about a cross-compiler that takes advantage of this vendor competition in cooperation to combine both communities of programmers into one pool targeting either virtual machine?
    • > How about a cross-compiler that takes advantage of this vendor competition in cooperation to combine both communities of programmers into one pool targeting either virtual machine?

      And in other news, Microsoft decides to bundle Cygwin with Longhorn...

      (ok so maybe Mono could do Java, not that I understand why they'd want to)
      • by jungd ( 223367 ) on Monday October 11, 2004 @11:52AM (#10494495)
        ikvm.net ( http://www.ikvm.net ) is a java VM for .NET/Mono that uses classpath for the JDK API. It can also statically cross-compile java bytescodes into IL code. For example, you can compile a .jar into a .dll (even the resources are preserved).
  • I'm confused (Score:4, Insightful)

    by abrotman ( 323016 ) on Monday October 11, 2004 @11:38AM (#10494269)
    Where's the story? Or is this just one person's interpretation of Java vs. C#?
  • by Palshife ( 60519 ) on Monday October 11, 2004 @11:38AM (#10494277) Homepage
    I've never seen so many grammatical errors. You win.
  • by account_deleted ( 4530225 ) on Monday October 11, 2004 @11:38AM (#10494282)
    Comment removed based on user account deletion
  • flamebait (Score:4, Insightful)

    by Bert690 ( 540293 ) on Monday October 11, 2004 @11:38AM (#10494284)
    It's times like this when you'd REALLY like the ability to mod the story itself as troll/flamebait!

    At this point (even before Whidbey) the deciding factor (as always) for Enterprise work, when choosing a language platform, should be the support it has behind it, in terms of IDE, tools, api, and longevity of the vendor pushing it (forget the OpenSource crap argument, those guys are too in love with Perl, Python, and Ruby - Java could become the child nobody wants to talk about if Sun dies) - right now that's C# and the .NET Framework ---

    • Re:flamebait (Score:3, Interesting)

      by oniony ( 228405 )
      Fully agree. The guy doesn't know what he's talking about. Java has much more support in the industry, .NET in the enterprise is currently painful. The tools are barely usable (Visual Studio debugger on a large application, anyone?) plus he makes some fundamental errors in the list. .NET does not support auto-unboxing for example (at least not .NET 1.0 or 1.1).
      • Re:flamebait (Score:5, Informative)

        by jeif1k ( 809151 ) on Monday October 11, 2004 @12:58PM (#10495195)
        .NET in the enterprise is currently painful.

        It's not about the enterprise, it's about the desktop. Microsoft had to do something there because C++ and MFC and COM was seriously getting in the way of getting the job done. Java isn't even trying to compete seriously on the desktop, so C# wins by default on the desktop. And (crazy as those people may seem to you and me) Microsoft desktop application developers actually seem to like Visual Studio. If Microsoft can additionally win market share from Java in the enterprise, that's icing on the cake for them.
  • by JUSTONEMORELATTE ( 584508 ) on Monday October 11, 2004 @11:40AM (#10494296) Homepage
    Why again can't I mod a story as -1 Flamebait?

    --
    I'll pay you $10. Really. [slashdot.org]
  • Java 1.5 vs c# 2.0? (Score:5, Informative)

    by hpj ( 26910 ) on Monday October 11, 2004 @11:41AM (#10494317) Homepage
    It's a bit unfair to compare the new Java 1.5 release with c# 2.0 since c# 2.0 is not due to be released until sometime Q2 or Q3 next year. But I do agree that before the 1.5 release Java had a lot of catching up to do to c#, but now c# is a bit behind (Mainly because of it's lack of support for generic classes which Java now supports).
    • by Anonymous Coward on Monday October 11, 2004 @12:05PM (#10494645)
      Comparing an unreleased version of C# to the available version of Java is just stupid. Further, with no mention of the provided API any discussion is a waste of time. While JAVA offers a bloated API, it is extensible and great for programming, unlike dot NET 1.1 which seems to be an attempt to build OO on top of a procedural framework that doesn't provide the programmer with the same level of flexability. The other thing to consider is that dot NET means normally a purchase of Visual Studio, while JAVA normally means a free download of the JSDK and JCreator. Also IMHO Java doc is much better then the stuff that comes with dot NET. The rest is rant......

      Comparing a released software product that is available almost for free to an unreleased product that costs hundreds of dollars is just dumb. Where is the story here?
  • by jcook793 ( 567065 ) on Monday October 11, 2004 @11:42AM (#10494328) Homepage Journal
    What language was this post written in? Amazing.
  • I want functions (Score:3, Insightful)

    by Tablizer ( 95088 ) on Monday October 11, 2004 @11:43AM (#10494338) Journal
    I want actual functions, not "activity objects". Almost everyone, except for the extreme OO zealots, agree that OOP is not necessarily the best approach to every problem.
    • There are people still arguing against OOP? How quaint.

      Why not argue against managed memory while you're at it.

      YES THIS IS A TROLL

      HITLER

  • by MojoRilla ( 591502 ) on Monday October 11, 2004 @11:43AM (#10494345)
    This would get a -1 Flamebait.

    My feeling is that these features are good news. There should be no gloating on the part of C#, it was clearly built on Java's coattails.

    Competition is a great thing, ain't it?
  • by Cloudgatherer ( 216427 ) on Monday October 11, 2004 @11:44AM (#10494364)
    Seriously, this looks like an ad for C#, a bunch of claims with very little support/evidence for those claims.

    I've worked on C# and Java projects. As far as I'm concerned, C# = MS Java. MS could not control Java, so they abandoned support for it and built thier own "version." It's really a rinse & repeat cycle for MS: see successful software, build own version of said software to try to take over that market as well.
    • I've worked on C# and Java projects. As far as I'm concerned, C# = MS Java.

      Ditto. I'd go so far as to say that .NET has some of the same bugs as the MS JVM and class libraries, especially in the networking support, where Java is streets ahead.

  • Corrected URL (Score:5, Informative)

    by waynegoode ( 758645 ) * on Monday October 11, 2004 @11:44AM (#10494369) Homepage
    The first link does not work. For the few who might not notice that the problem is the extra / at the end, thep link should be this [sun.com].

    Perhaps /. will correct the error. I emailed the editor when the story was in preview, but it was too late.

  • I call bullshit (Score:5, Insightful)

    by The Bungi ( 221687 ) <thebungi@gmail.com> on Monday October 11, 2004 @11:45AM (#10494383) Homepage
    There is no apparent point to this "story". It's full of grammatical errors and obvious flamebait arguments (flamebait in the context of the slashbot groupthink). What, "C# is teh roxx0rz and Java.. well, I forgot teh point I was makeing for Java"? "The open source crap argument"? Way to go.

    Here's my theory. Along with the ubiquitous slashvertisements and the Microsoft-bash-of-teh-day barrage posts, these are a perfect opportunity to create a story that will generate 1,000+ comments and ten times those many page views and ergo ad impressions.

    C'mon, C# vs. Java? Outside of "RIAA sues 86 year-old grandma", "We hate Bush, let's talk" and "Microsoft patents KDE" there is no better source of inflammatory material in the dorkosphere.

    Sad, really.

  • the crap argument (Score:5, Interesting)

    by iamchaos ( 572797 ) on Monday October 11, 2004 @11:46AM (#10494386)
    Is this article flamebait? Maybe I am just misunderstanding when he says:

    "At this point (even before Whidbey) the deciding factor (as always) for Enterprise work, when choosing a language platform, should be the support it has behind it, in terms of IDE, tools, api, and longevity of the vendor pushing it (forget the OpenSource crap argument, those guys are too in love with Perl, Python, and Ruby..."

    Which "crap" argument is he talking about? I assume he means that when using those languages you have thousands of directions to go for help in howtos, docs, tutorials, books and of course the loving #perl. I normally would not reply to something like that, but I took offense. Yes I love those languages. They all have strong points and make life fun when coding. I have support and have never had to rely on a company to provide said support. Oh yeah, and I write enterprise software with the mod_perl crap everyday of my life. Thanks.

    iamchaos
  • Version (Score:4, Funny)

    by xPhoenix ( 531848 ) on Monday October 11, 2004 @11:46AM (#10494392)
    So which version number is it? Java 2, Java 1.5, or Java 5? Someone should teach these guys to count before they start coding!
  • Optimization models (Score:3, Informative)

    by scumbucket ( 680352 ) on Monday October 11, 2004 @11:46AM (#10494393)
    Java has a few advantages over C# in optimization. It's very easy to analyze Java programs to be certain that certain memory locations absolutely will not be modified. That's much harder in languages with native pointers. Those invariants allow you to compile out certain calculations that would have to be done at runtime in a C# program. You can even start spreading loop cycles over multiple CPUs, but I'm pretty certain that the present JVMs aren't that smart.
  • Mistake (Score:3, Insightful)

    by ajs ( 35943 ) <ajs.ajs@com> on Monday October 11, 2004 @11:47AM (#10494409) Homepage Journal
    I'm not pleased with the "catch-up" game that Java is playing here. Java was a fairly nice middle-ground betweeen high and low level programming, and what appears to be an effort to become a high level language is rather ominous for those who are interested in testability and performance in Java.

    This, BTW, is why you don't want your language to be controled by a company which in turn has a marketing-driven bottom-line. The idea that two languages could co-exist with different target audiences is nonsense to marketing droids, but perfectly reasonable to someone like Guido van Rossum, Larry Wall or any of the other maintainers of truly open-source languages. Open source isn't the only way to maintain this focus, but in today's marketing-driven world, you aren't likely to see too many Bell Labs-like organizations putting out languages like C (which was semi-open source, as was Unix). Java and C# are probably much more typical.
    • Re:Mistake (Score:5, Insightful)

      by Sanity ( 1431 ) on Monday October 11, 2004 @11:56AM (#10494542) Homepage Journal
      Java was a fairly nice middle-ground betweeen high and low level programming, and what appears to be an effort to become a high level language is rather ominous for those who are interested in testability and performance in Java.
      Generics improve testability because they largely eliminate runtime ClassCastExceptions. I haven't seen any evidence to show that any of these features impose a performance penalty. Most just make the developers life easier by saving them from repeating common code patterns.
      This, BTW, is why you don't want your language to be controled by a company which in turn has a marketing-driven bottom-line.
      Yeah, because hardly any companies are driven by their bottom lines...
  • Heh (Score:3, Funny)

    by KoolDude ( 614134 ) on Monday October 11, 2004 @11:50AM (#10494461)

    SexyFingers writes "Sun released Java 1.5...

    The ultimate question is... how did you get those sexy fingers ? Java, C# or... Pr0n# ?

  • AVP (Score:5, Funny)

    by pizza_milkshake ( 580452 ) on Monday October 11, 2004 @11:52AM (#10494477)
    It's just like Alien vs. Predator:

    whoever wins, we lose.

  • IIS vs J2EE Servers (Score:5, Informative)

    by knitterb ( 103829 ) on Monday October 11, 2004 @11:52AM (#10494494) Homepage
    It's not so much the language that is a question of contest, but the platform they run on. I've done Java programming since 1.1.8, and have deployed on Tomcat, Resin and Weblogic.

    Recently I switched to C# (new job) and I have to tell you, the language is pretty neat with some of the tricks you can do. Nothing ground breaking though.

    What's really missing is the platform for release, and release management. Where are WARs and EARs for .Net? What the fuck is up with IIS (oh yeah, it's crap)?? Where is any sort of replicated server side session management (no, long ass hidden fields are *not* sessions - and a M$SQLServer *only* solution doesn't count).

    The constructs and tricks of a language can be debated as long as you want. You will probably find something nice in every language. But when you have to [operationally] deploy any application, great or not, on some cheap as shit, crap ass, hard to manage, non-repeatable platform such as IIS, that's when the real rubber hits the road with Java.

    J2EE deployment platforms are light years ahead of .Net's deployment platform (singular). Man I miss working with J2EE platforms and loathe IIS...even though it is my job to keep all this stuff running on IIS! :(
  • by daveho ( 235543 ) on Monday October 11, 2004 @11:53AM (#10494500)
    While neither Java nor C# is truly free of being controlled by an Evil Corporation(tm), Java at least has multiple vendors, runs on a wide variety of platforms, and has an open standardization process [jcp.org].
  • by JPyObjC Dude ( 772176 ) on Monday October 11, 2004 @11:54AM (#10494522)
    so if you're doing C# and you're foundations in OOP is rock-solid, there really isn't any difference whether you're coding C# or Java.

    He kind of forgot that there are many programmers and customers who DON'T want to deploy their systems on win32. With Java apps, you don't have to. In fact you can choose almost any operating system and hardware. Anybody who chooses C# over Java for enterprise deployments is truly a MicroWeenie.

    I much prefer my 8 processor HP UX box any day :]

    • by pesc ( 147035 ) on Monday October 11, 2004 @12:14PM (#10494740)
      You are right. One main feature that Sun designed for Java was WORA (Write Once Run Anywhere). M$ thought this sucked. They tried to destroy that feature and got sued over it. So the invented C# instead. C# isn't WORA, it is WORM (Write Once Run on Microsoft). With C#, you are locked in again. That's the whole point with C#.
  • by otisg ( 92803 ) on Monday October 11, 2004 @11:58AM (#10494562) Homepage Journal
    It is this similarity and 'compatibility' of Java & C# that is now making it easy to port various applications between the two languages. For instance, the very popular Lucene (Information Retrieval library from Jakarta (i.e. Java)) has a very solid .Net port written in C# called dotLucene. The Lucene -> dotLuene port is fairly automated, it appears, which allows developers of the .Net/C# port to keep up with the original software written in Java.

    If C#/Java continue in this direction, I think we will see many more applications that have parallel versions in the two languages.

    See:
    Lucene [apache.org]
    dotLucene [sourceforge.net]
  • by miguel ( 7116 ) on Monday October 11, 2004 @12:04PM (#10494621) Homepage
    There are some important limitations of generics in
    Java, which are properly addressed in C#.

    For more details, you might want to read:

    http://www.artima.com/intv/generics.html

    C# still has a few extra niceties like properties,
    events, delegates, anonymous methods and iterators.

    Miguel.
  • by mmusson ( 753678 ) on Monday October 11, 2004 @12:05PM (#10494640)
    My biggest beef with java right now (well Sun, really) is that they are make design decisions in the name of backward compatibility that are leading to poor design choices. Backwards compatibility is an important consideration, but it should not be used as an excuse to make poor design decisions. I use a variety of java programs day to day that only work with certain VM versions due to bugs, features, etc. It seems silly to give this one aspect such heavy consideration as if the current java versions are perfectly backward compatible today when they clearly are not.

    The new generics feature is clearly patterned after C++ templates, but in the name of backwards compatibility Sun chose to implement generics using erasure. This means that a generic type loses all of its type information leading to a alot of issues including broken support for arrays. Using erasure keeps much of the potentially confusing syntax of C++ templates and virtually none of the power.

    I suppose I would be less upset if the feature had a different name. Maybe something like AutoCasting (like the name AutoBoxing). "Generics" implies things that the feature does not even try to deliver. Adding true generic programming constructs to java would have been a huge leap forward for the language. Instead we are left with a toy feature that allows you to build type safe containers, nothing more. Very disappointing.
  • API talk... (Score:3, Informative)

    by Chuck Bucket ( 142633 ) on Monday October 11, 2004 @12:10PM (#10494700) Homepage Journal
    Funny, we were talking about the 1.5 APIs last week here at work, while talking about migrating our apps over from 1.4.x. This site Official Java Programming Documentation [jhu.edu] gives you a ton to think about. I rem when we were on 1.2...

    CB*($#@
  • by drgroove ( 631550 ) on Monday October 11, 2004 @12:11PM (#10494717)
    Last time I checked, few industries were doing enterprise development with J2SE, regardless of the version. J2EE is the preferred platform for enterprise application development (hence the 'EE', or 'Enterprise Edition', after the 'J2' bit). J2SE 1.5 is a great release, but it means little currently for J2EE developers.

    The new features to Java in version 1.5 are all anticipated and appreciated by the development community, but us J2EE developers won't be able to access these new features in our apps until the official J2EE 1.5 release comes out, and the various app server vendors (IBM, BEA, Oracle, Sun, JBoss, Apache, etc.) support it in their products.

  • April 1st? (Score:3, Insightful)

    by cthrall ( 19889 ) on Monday October 11, 2004 @12:18PM (#10494778) Homepage
    > should be the support it has behind it, in terms
    > of IDE, tools, api, and longevity of the vendor

    Eclipse/IntelliJ/Together
    Apache/Tomcat, WebSphere, BEA
    RedHat/Suse/Mandrake/Debian

    All of these tools and vendors have been around longer than C# and .NET.

    > pushing it (forget the OpenSource crap argument,
    > those guys are too in love with Perl, Python,
    > and Ruby - Java could become the child nobody
    > wants to talk about if Sun dies) - right now
    > that's C# and the .NET Framework ---

    You misspelled "FUD."
  • still very different (Score:5, Informative)

    by jeif1k ( 809151 ) on Monday October 11, 2004 @12:27PM (#10494880)
    Don't be fooled by syntactic similarities; C# and Java are still very different languages:
    • C# has value classes
    • C# has operator overloading
    • C# has multidimensional arrays
    • C# has unsafe modules; in unsafe modules, you can call C functions directly (no JNI) and manipulate C data structures and pointers
    • C# does not force you to declare exceptions
    • C#'s generics are efficient for unboxed types while Java boxes in many cases
    • C#'s generics are type-safe across compilation boundaries (I believe Java's are not)

    Basically, Sun did a bunch of things they could do without changing the VM too much and without breaking old code. But for a bunch of other features, they punted and just added a bit of syntactic sugar to the compiler that makes Java look superficially like it's doing the same thing but is much less efficient under the covers.

    For enterprise applications, those differences may not matter much (and they may even be harmful), which is probably why Sun doesn't do anything about them. But for desktop use and application programming, they do matter. Microsoft wanted to create a new language that their legions of C++ programmers could use, and C# is a pretty credible answer for that. Those people don't care about cross-platform features, they care about getting the job done, and if that involves the occasional unsafe module, it doesn't matter to them.
  • by flakac ( 307921 ) on Monday October 11, 2004 @12:28PM (#10494897)
    Sorry, but there are still some major differences in the two. I've looked at the new features in Java 1.5 and agree that yes, they are definitely a plus.(Note: I code nowadays almost exclusively in Java):
    • No unsigned integer type in Java -- if you need an unsigned long, you're SOL. So it's pretty difficult to code certain numerical algorithms (compression and encryption, anyone?)
    • Java the language is inextricably tied to the JVM - C# is just another option for developing for .NET.

    For enterprise-grade work I still prefer J2EE over .NET, but that really more depends on what client I'm working for at the time. At the end of the day, both get the job done.
  • by Manitcor ( 218753 ) on Monday October 11, 2004 @12:42PM (#10495011) Homepage
    that I dont care which a client wants anymore. Its like asking for 6 of one and a half dozen of the other. I had been afriad of learning Java for ages but knew C# very well. Then I forced myself to learn Java and as soon as I got into it I kept saying "Wow MS copied Sun!"

    When you think about it though good OO concepts tend to evlove toward similar goals. Languane and usablitly concepts are the same all around. Its to the point now where the differences between Java and C# are more syntax and available libararies. Ive even been able to easily port Java to C# and vice versa since the languges are so similar.

    It has defintaly opened up things more for me, as now I leave it to the client as to what they want. If they are an MS shop then C# is an obvious choice if they use Linux or perfer alternative platforms then Java is obviously what you should build in.
  • Java's primitive types are not objects. There's no reason they couldn't have been (compilers that generated efficient arithmetic code from high level components date back to the '70s) but they're not... which means you have to drop down to C-style types over and over again.

    It hinders programming efficiency, and it hinders code efficiency: any place where primitive types can be used, the compiler can infer that primitive code can be generated, any place it can't you'd have had to use object types... but the compiler is MUCH smarter about figuring where casts need to be than average (or even above-average) programmers.

    Smalltalk is "OO from the ground up". Java is "OO from the Integer up".
  • by nzgeek ( 232346 ) * on Monday October 11, 2004 @01:37PM (#10495637) Homepage Journal
    I've done enterprise-level Java and C# implementations for financial institutions, and reckon there is one thing that people always miss when comparing the two languages: installation.

    C#, despite any other flaws, Just Works(tm). Install Visual Studio, write some code, click the run button. Sure it takes a bit of thinking to get a n-tier implementation up and running properly, but the installation of the back-end stuff (IIS, db connections, remoting) is incredibly simple.

    On the other hand, to get enterprise Java (J2EE, although some would argue that a class library is easier and more versatile), you need to learn how to install an app server (JBoss, Orion, or god forbid WebSphere), and how to configure that system for database connections, performance, session and object permanence, etc..

    None of this really matters in a 'big-iron' enterprise environment, because there's room to hire a websphere monkey to look after the cat-herding. In anything below a mega-corp or mega-bank however, the overhead of running Java can sometimes be a burden that developers just don't want to think about.

    I see it kinda like using Firefox over IE. They both do pretty much the same thing, and one does it 'better', but at the same time requires some effort to implement. Some people just can't be bothered with the effort.
  • by hopethishelps ( 782331 ) on Monday October 11, 2004 @03:23PM (#10496774)
    5. Varargs (C# 1.0's params construct, ellipsis construct in C++)

    As Stroustrup says of the ellipsis construct in C++, "The most common use of the ellipsis is to specify an interface to C library functions that were defined before C++ provided alternatives", and gives an example of the "extra work that face[s] the programmer once type checking has been suppressed using the ellipsis." Using the ellipsis construct, other than where it has to be used to access some legacy C library, is definitely very poor style in C++.

If you didn't have to work so hard, you'd have more time to be depressed.

Working...