Slashdot Mirror


C# From a Java Developer's Perspective

Microsoft's C# has raised eyebrows, interest and debate since its official announcement last year. The prolific Carnage4Life (Dare Obasanjo) has completed a detailed comparison of C# and Java, outlining the things that are identical, similar, nearly the same, or completely different between the two languages. If you're considering learning or applying either one, you might benefit by reading this paper first. There are some other excellent comparisons to be found linked from the Open Directory Project as well. Update: 11/20 03:35 GMT by T : Note: here's a mirror; interested readers who mirror the mirror get good seats in heaven.

39 of 507 comments (clear)

  1. Some more information by nll8802 · · Score: 3, Informative

    There is a good, clean quick overview of C# here. The also do some comparison of C# to Java.

    1. Re:Some more information by SanLouBlues · · Score: 3, Interesting

      This comparison is decent, but makes a few uninformed comments.

      This is typical code you might write in Java or C++:

      foo.setSize (getSize () + 1);
      label.getFont().setBold (true);

      The same code you would write like this in C#:

      foo.size++;
      label.font.bold = true;

      The C# code is immediately more readable by those who are using foo and label.

      True, but this easy method can be done in Java with public member variables, it's just discouraged.

      Declaration:

      public enum Direction {North, East, West, South};

      Usage:

      Direction wall = Direction.North;

      It's a nice construct, so perhaps the question is not why did C# decide to have them, but rather, why did Java choose to omit them? In Java, you would have to go:

      Declaration:

      public class Direction {
      public final static int NORTH = 1;
      public final static int EAST = 2;
      public final static int WEST = 3;
      public final static int SOUTH = 4;
      }

      Usage:

      int wall = Direction.NORTH;

      The java method will compile/run a tad faster, due to the lack of an entirely new type.


      There may be more . . .

  2. how is it... by Lord+Omlette · · Score: 3, Troll

    that Carnage4Life, the slashdotter's slashdotter, couldn't anticipate and survive a slashdotting?

    --
    [o]_O
  3. The lesser of two evils by Walter+Bell · · Score: 5, Insightful

    Disregarding the fact that Java and C# are both "closed" languages controlled by large corporate entities with their own self-interests in mind, they both do an admirable job of bridging the gap between general purpose scripting languages and C++. Having used C# and Java on Win32 extensively in the past year, I have become accustomed to the automatic garbage collection, quick execution speed, and logically consistent design of both languages. The Windows compilers / runtime engines for both languages are quite amazing, and something for the fledgling gcj to aspire to.

    Although C# does deliver superior integration with Windows and .net (which is good for MS-only developers and bad for multiplatform programmers like myself), I'd have to pick Java if it was up to me just because of its sheer elegance. It seems like Sun did a better job designing a general-purpose language (applet "security" extensions aside), and Microsoft just tried to copy Java but add in proprietary extensions to hook C# into Windows. Thus, some of the C# features seem to be "bolted on", whereas most of Java came across as being very natural to me.

    Just my 2c...

    ~wally

    1. Re:The lesser of two evils by Steveftoth · · Score: 5, Insightful

      If c# takes off for windows programming I think it will be because people will be able to build responsive GUI programs with it. The largest problem with Java is people's conception that it is SLOW. Java coders know that is not true in general. However, AWT and Swing are slower then they need to be because of their cross-platform compatability. If you can build a responsive GUI program in less time using C# then I think it will be the language of choice for many coders. C++ takes more time to get all your bugs out, Java gets rid of the possiability for many bugs, (while introducing others, but there are less overall) and reduces time of coding.

      Also, you'll be able to use all the newest 'must have features' that MS tries to shove on the consumer in C#.

      For now, I'll stick with Java because it's libraries are much better. Not just the ones that Sun wrote, but more importantly, the ones that other people have written.

    2. Re:The lesser of two evils by redcup · · Score: 4, Funny

      Java and C# are both "closed" languages controlled by large corporate entities with their own self-interests in mind

      Agreed - but Java at least attempts "write once, run anywhere," (with debatable success) whereas M$ C# attempts "write once, run on Windows XP, with Windows Messenger and a .Net Passport or else"

      I have a lot more faith trusting my applications and business to a company that isn't trying to take over every purchasing decision we make. If you have read the fine print that comes with Windows messenger - the other half of .Net - it essentially gives Microsoft the right to modify the application at any time, with out notifying you. Oh, and these upgrades might not be free! The bottom line? Microsoft is going to decide sometime in the future to cut you off, and then make you pay. And you would trust these people not to do the same with C#??

      One day your app or service isn't going to run, and all you see in your logs will be "Call Miscrosoft to obtain a license to run C#"

      --

      RC
    3. Re:The lesser of two evils by nebby · · Score: 3, Flamebait

      That was perhaps the best troll I've ever seen posted on Slashdot. The only reason it didn't fool me is because I've been developing C# for the past month and before that was doing Java for 3 years or so. C# is better, hands down, as long as you don't want cross-platform compatibility.

      --
      --
  4. C# and .NET vs. Java Enterprise APIs and tools by MarkWatson · · Score: 4, Insightful
    Good summary of similarities and differences between Java and C#.

    I spend most of my time in the Java world (I have written 5 Java books, the latest of J2EE, and almost all of my consulting is done with Java.)

    That said, C# and Visual Studio.Net are very cool.

    Since Java is not my language of choice (hey, I would use Common LISP more if there were more consulting jobs requiring LISP!), I would not be too bothered if I had to use C# and the .Net stuff.

    Really, what really matters is finding interesting jobs to do, not the development platform.

    I also have high-hopes for interop between the Java J2EE world and .Net using SOAP. (I am working on SOAP support for Common LISP in my spare time so Lis can play nice with .Net and J2EE.)

    Best regards,

    Mark Watson

  5. Come on now: Have you ever really used C#? by ergo98 · · Score: 5, Insightful

    Seriously though, have you? From your vague, unsubstantiated, no example posting it sounds like you use and know Java, therefore you can proclaim yourself knowledgable about C#. Your claims about the "bolted on" aspects of C# are particularly suspicious given the "hooks" into Windows are simply objects instantiatable from the .Net Framework (they're not "bolted on": Just like Java you include the unit and create objects from it). If anything C# takes some of the goofy aspects of Java, such as the interoperation with properties via methods, and cleans them up to make an abstract behind the scenes property handling system (ripped straight from Delphi's object pascal I would guess).

  6. Standardization? by mugnyte · · Score: 3, Insightful

    Language improvements have historicially opened the door to new productivity - in real terms - of apps getting cranked out. Higher and higher encapsulation in text or GUI worlds...but they don't all stick to the wall.

    One cannot always tell beforehand how big the impact will be. Small movements have exploded once given a niche to fill... and then die once it was swallowed up by a new contender.

    If the benefit of C# is only whats in this article, then I'm not convinced its going to change the world. I'll keep to my "unsafe" code blocks and maintain interoperability with non-Gatesian worlds.

    I'll wait for at least a committee for standardization to form for this mess.

  7. Why do I get the sinking feeling by GISboy · · Score: 4, Funny

    with C# that "cross platform" will eventually mean Win9X, ME, NT, 2K and XP?

    Or in some ominous "Morpheous" like voice:
    "The .NET-rix is everywhere...."

    Or maybe I'm just reading too much into it... after all, Microsoft is doing it for the good of the community and Developers (developers, developers, dev....).

    BWAAAAHAHAHAHAHA...I actually kept a straight face while typing that...heh.

    {sniff, wipes tear from eyes..heeeheee}

    --
    If it is not on fire, it is a software problem.
    1. Re:Why do I get the sinking feeling by spongman · · Score: 3, Insightful
      since the C# language has been submitted to the ECMA group it's likely that implementations will appear for non-Microsoft platforms.

      in fact, one such port seems to be coming along very nicely.

    2. Re:Why do I get the sinking feeling by vanza · · Score: 4, Insightful

      But will they be standardizing the libraries or just the language (and the CLR for that matter)?

      The beauty of Java is that you write your code once to a set of libraries that are available on a lot of platforms. Even if you had to recompile the code on each platform, there would be no problems because there's a standard library to which you code.

      But, if only C# the language is sent to the ECMA, won't we have another C/C++/ with different features? The code you write will still be specific to the libraries you choose to use (and thus the platforms those libraries are available).

      --
      Marcelo Vanzin
    3. Re:Why do I get the sinking feeling by spongman · · Score: 3, Insightful
      i believe that the language and core runtime features are being standardized. as for the rest of it (ASP.NET, ADO.NET, WinForms/GDI+, XML/WebServices, etc...) even though they may not be an open standard as such, Microsoft's implementation and specification will serve as standard enough for others to provide compatible implementations on other platforms (eg: Mono), in exactly the same way as has happened for Java.

      Microsoft has historically been pretty good at keeping their SDKs backwardly compatible and I don't see any reason why they would break the compatibility of future .NET runtimes (the non-ECMA bits). Some would say that they'd do that just to break the 3rd party implementations, but in reality they'd lose more by pissing off their own developers than they'd gain.

  8. Ouch! by pi+radians · · Score: 3, Insightful

    Hey, I take offence to that!

    I've been forced to write sites in ASP/SQLServer on a number occasions because thats what the client asks for (they figure if its all IIS and VBScript it'll run better, I know, dumb). So before you decide to look down upon someone using C# or VB or anything else, realize that there are a number of factors that go into what technology is used.

    (I wish I could say my morals could standup to such a request, but low and behold, I want money too.)

    Seriously, why do you expect someone to only code in a certain language? I feel that the more you know, the better a job can get done. Just because its a MS language doesn't mean that it is useless. You should do what's best for the client.

    --

    sin(6cos(r)+5A)
  9. Power of Java, Functionality of Windows by ClubStew · · Score: 5, Insightful

    I admit that Microsoft is once again trying to dup Java, but, if you like Java and wish to work with platform-dependant API's that do more with Windows than Java, C# is your answer!

    As the article mentions, C# has almost the exact same syntax and keywords that Java has (plus PERL's foreach operator...kudos). There is almost no learning curve. You can leverage the functionality of Windows with C# however, and it has great XML support; so, if you've worked with the MSXML parser, you'll have no problems working with XML in C#.

    C# deserves a little more credit than many give, at least if you're working in a strict Windows environment. It's worth a look.

    That's all I have to say, but I'll pile on the on wood for the flames that will arise!

    1. Re:Power of Java, Functionality of Windows by ClubStew · · Score: 3, Interesting

      Granted, C/C++ is my language of choice on any platform (unless you're designing cross-platform code, which Java works great for). You have to admit, however, that C/C++ requires greater thought and strong fingers for all the typing you have to do. C# is an abstract language like Java and requires less (and, yes, it does hide more, which can be bad in some cases).

      Just like any language, each has its strengths and weaknesses. If you're looking for abstraction and rapid development on Windows, C# is worth a look. If you're looking for speed (and, seriously, once the .NET framework is loaded, C# isn't too bad on speed), go with C/C++ for faster code and lower-level calls and memory management and stuff.

  10. Java != Sun by RichiP · · Score: 5, Informative

    Although Sun engineers are handling the boards, the direction of Java is mostly influenced by the general public through the Java Community Process (See http://www.jcp.org/). Sun simply acts as an arbiter and caretaker.

    If there are any good ideas in C#, there's really no reason it couldn't be adopted by Java. Someone just has to submit a request

  11. Big companies... by Eusebo · · Score: 4, Insightful
    I work for a rather large international bank and I can say we've been moving away from Microsoft as fast as you can say "dot net". From what I've seen this is true of many of the other firms in the financial sector as well. I suspect a large part of the reasoning is not the superiority of Java, but rather is the "anything but Microsoft" syndrome in effect. I seriously doubt that C# will be considered here as a replacement for Java any time soon.

    I have a feeling that C# will be adopted by Microsoft's technology partners, but why would any firm that has spent time and money moving away from Microsoft products go running back because of a new product offering? Its not the products we're trying to get rid of, its the company.

    --
    It is quite simple
    Haiku should not be funny
    Try a Senryu
  12. I'm impressed by C# -- the language by GCP · · Score: 5, Insightful

    I've been a fan of Java since it was still in alpha, in early '95. I even wrote a piece of the Swing API. I'm still a Java fan (and developer), but sadly not for GUI apps. MS ("we own the client") and Sun ("we're not going to let this become just a better way to write Windows apps") collaborated to kill Java as a viable way to produce commercial-grade consumer GUI apps.

    We need a modern, productive system for producing new high-performance GUI apps: apps that look and feel as if they'd been written in C++ -- without the crashes and slow dev cycle. I'd give up some of the flexibility of C++ (you can write drivers, create an OS, build a browser, it's a dessert topping AND a floor wax) for something truly optimized for what matters most in creating superb GUI apps quickly and well.

    I've had high hopes for Eiffel and some others to evolve into the successor to C++ for GUI apps, but it never happens. The inertia of programming languages is immense.

    The next to step up to bat is C#. I like the language a lot and think it lends itself to great dev systems. I'm suspicious of the bytecode aspect, though. ("Faster than compiled!", "It actually is compiled!", etc. Yeah, so why isn't Solaris written in Java?) I'm afraid that aspect will still require that "serious" apps be written in C/C++.

    I like even less that it may remain Windows-only. If it does remain Windows only (for all practical purposes), I suspect the blame will belong just as much to MS haters dismissing it primarily out of bigotry as to MS for optimizing it for their own platforms.

    I'd like to see the open source community look at it with the same eyes as if it had come out of some smelly hacker's basement.

    --
    "Those who have never entered upon scientific pursuits know not a tithe of the poetry by which they are surrounded."
  13. Multiplatform increasing in importance by GunFodder · · Score: 4, Insightful

    It sounds like C# has some nice features that Java doesn't, but I have my doubts that Microsoft will make it multiplatform. And that is becoming more important as the range of computing devices widens.

    Servers tend to run Unix or legacy OSes. Embedded devices run Palm OS or a free Unix like Linux or BSD. Phones run all kinds of custom software. The only platform that Windows rules is the desktop, and that market segment just shrunk for the first time in history. How can C# dominate if it only runs on one type of device?

  14. my $0.02 by vscjoe · · Score: 5, Insightful
    I think from the level of people who make decisions about what programming languages to use on commercial projects (this includes me), the technical distinctions between Java and C# are of little concern: the languages are so similar that they are basically interchangeable. What matters is who supports it, what libraries are available, how mature are the implementations, whether it's a single-vendor or mult-vendor solution, how well it integrates with the platform, and how many programmers are available.

    For pure Windows programmers, C# wins there and will probably be picked up by lots of VB and VisualC++ programmers. But people who live in that world are already not using Java. For everybody else, Java seems to win hands down. I think C# will neither be a complete failure nor will it do much harm to Java.

  15. Interesting, but there's an error... by ncc74656 · · Score: 3, Informative
    From the linked article:
    In languages like C and C++, each subarray of a multidimensional array must have the same dimensions.
    I'm fairly sure you could do something like this in C or C++:
    int** foo=(int**)malloc(sizeof(int*)*2);
    int* foo[0]=(int*)malloc(sizeof(int)*3);
    int* foo[1]=(int*)malloc(sizeof(int)*9);
    That will set up a jagged array with the same dimensions as in the given C#/Java example. It will be addressable in the same manner. It won't have the bounds checking, but I suspect that the comment regarding Real Programmers and strong typing could be extended to bounds checking. :-)
    --
    20 January 2017: the End of an Error.
    1. Re:Interesting, but there's an error... by Fjord · · Score: 3, Informative

      This isn't right. C can do truely multidimensional arrays. If you say char[30][20] x it does one allocation of 600 contiguous bytes. When you use the array like x[10][10] it computes the full offset as in Pascal and BASIC, and then does a single pointer add. Here is an ok page that talks about C multidimensioned arrays.

      But Java and C# don't actually let you have jagged multidimentional arrays like this. They have like you said in your first post, an array of pointers, which is valid in C. One wonders what the writer of the article thinks argv is (typed char*argv[])

      --
      -no broken link
    2. Re:Interesting, but there's an error... by man_ls · · Score: 3, Informative

      Multidimensional arrays in Pascal are childishly easy, even in insanely large numbers of dimensions.

      type xarray=packed array[0..20,0..20] of integer;
      var data:xarray;

      That's a multidimensional array for you, with a data type so you can pass it to a function.

      If you'd wanted, but didn't feel like passing it to functions (i.e. no data type so it couldn't pass correctly) you could write

      var data:packed array[0..20,0..20] of integer;

      and accomplish the same thing. Either is accessible with a somple

      data[x,y] structure, that can be controlled by FOR/WHILE loops, IF statements, and the like. Last year, I was working in truely 3-dimensional arrays in PASCAL to store data for an airline seating chart.

      type xarray=packed array[0..20,0..20,0..20] of integer;
      var data:xarray;

      data[x,y,z]

      And even 4+ dimensional arrays "worked" but I'll be damned if I could visualize them in any coherant way.

      type xarray=packed array[0..20,0..20,0..20,0..20] of integer;

      It may have been a fluke that it worked at all, but I did a relatively simple program to fill up each space with random data and writeLn() it out, just to see if it worked. For that big of a data structure, you could probably do much better using records, or seperate linked arrays if Pascal can do such a thing.

      I've never done any programming work in BASIC so I can't speak for it's handlig of multidimensional arrays. I don't recall them being too hard from a program I looked at though, something to the effect of

      DIM variable%type% AS array (x,y) or something.

  16. foreach...kudos by GCP · · Score: 3, Interesting

    In the alpha days of Java, I suggested to Sun that they incorporate some very popular Perl features, such as a foreach and containers that allowed for such things as "foreach char ch in myString" or "foreach int i in myIntVector" or "foreach int i in 30..1", etc.

    The senior designers repeatedly treated such suggestions with contempt. Arthur van Hoff told me, "If you want to use Perl, just use Perl!"

    The MS people I spoke to in the early stages of C# were very interested in input like this. Where Sun's attitude toward "why can't we have X?" was "because we said so", MS's was "hmm, that would be popular, I wonder if we could find a way...."

    Say what you will about MS, one of their standard techniques for locking you in is to try to make what people are asking for. Contrast this to Apple and Sun ("we're your superiors, so use what we tell you to use"), and Linux ("make it yourself, luser!").

    --
    "Those who have never entered upon scientific pursuits know not a tithe of the poetry by which they are surrounded."
  17. w00t? no dynamic class loading? by mnf999 · · Score: 4, Informative

    I did not know that (and couldn't read the full description as the site is totally /.ed :(

    I design JBoss, the leading J2EE server and at THE HEART of it is the capicity to dynamically deploy new applications on our application server. I mean that is what application servers are ALL ABOUT.

    in fact (plug) in JBoss we go the extra mile and allow you to hot-deploy (dynamically add classes) the server classes themselves, which neither IBM nor BEA, nor Oracle do.

    So I was curious to know who would win the .net webservices race but it is extremelly clear in my mind, J2EE frameworks will deliver with webservices easier than any C# framework will

    Why? well imagine that ANY time you change your class in C# YOU NEED TO REBOOT THE APPLICATION SERVER, yes, boys and girls that is the simple thing that "dynamic class loading" affords you, without it, the VM is tied to whatever you have at startup.

    GEEEEZZZ!

    --
    The real mnf999 always posts as anonymous coward
  18. Having used .NET by f00zbll · · Score: 3, Informative
    I haven't used C#, but I am using .NET on a project. From my experience so far, the .NET platform has a long way to go. It's good that C# will make things easier for developers, but like all languages with wide adoption, bloat will inevitably occur.

    The first release of .NET will still be 2-3 releases from full fault tolerance and enterprise level computing. There are alot of complicated processes in enterprise computing and Microsoft's .NET platform as it stands today is far from meeting those needs. Microsoft has yet to define really useful modules and standards for complex processes that span multiple systems which include legacy VMS systems and modern solaris 8 applications.

    SOAP is great for simple processes, but it is far from adaquate to handle distributed and transactional processes. Using standards like UDDI is a great step towards easing multi-platform integration. Instead of having different divisions of the same company design different API for publishing resources, it will be easier to have a common way of doing those things. It is not uncommon for financial institutions to store information differently. Take a simple think like address. Some places may store the number in a separate field, while others may replace "jr" with "junior". Anyone who has worked with large mixed environments knows this fact. SOAP is a message centric way of doing things. It is not designed for complex processes. The stuff IBM is building around SOAP is more complete than Microsoft's offering, but then again IBM has been at services longer.

  19. So how exactly... by Anonymous+Brave+Guy · · Score: 3, Insightful

    ...do you use a language that won't even properly exist until February next year, when Visual Studio.NET will actually be released?

    --
    If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    1. Re:So how exactly... by ergo98 · · Score: 3, Informative

      Well given that Beta 2 has been available for closing on a year now, and I've had RC1 on my machine for about a month now... That's how I use C#.

  20. My take by nebby · · Score: 5, Interesting

    I've been a Java programmer since JDK 1.0 came out, though I've really done most of my Java coding with server side servlet stuff since the GUI library has, and probably always will, suck the wanker.

    I just recently picked up C# about a month ago. The learning curve from Java was pretty damn low, only with a few different naming conventions and new language constructs. Things such as indexers, delegates, and the like (all of which I feel are positive additons to the language.) The event model, to my surprise, is better than Java.

    Then after learning the language itself I started looking into Windows Forms and nearly spooged my pants. Finally Windows progammers get a clean framework of GUI controls with a powerful modern language behind it (ie, not C++ or VB.)

    Usually if you wanted to make a powerful Windows app you were forced to use C++ since VB didn't really cut it. Now you can use C#. Complex Windows apps are going to be a whole lot easier to write now, nevermind the fact that they'll be able to do remote method calls via SOAP, and be deployed effortlessly (ie, create a Windows Installer in like 3 clicks or something.)

    I have to say, for the stuff I'm writing that I don't need cross-platform compatibility (which I did surprisingly find to work in the case of servlets) .. C# and the .NET framework wins hands down.

    --
    --
    1. Re:My take by Malcontent · · Score: 3

      You could have used Delphi all along but you seem to think that only products you can use on windows are MS products.

      --

      War is necrophilia.

  21. Langs the same. Companies differ. by mactari · · Score: 4, Interesting

    I've done a little C# programming and I've done more Java programming. Heck, I've even done some J# (http://msdn.microsoft.com/downloads/default.asp?U RL=/downloads/sample.asp?url=/msdn-files/027/001/7 54/msdncompositedoc.xml) programming.

    The things that make these two different as a language are pretty trivial. As a Chem. Eng. professor told me when I asked if I needed to bother with FORTRAN when I already knew Pascal, "They're all different dialects of the same langauge".

    The only real difference is that you'll want to use the dialect best suited to your particular programming task. If you want to leverage code written in .NET quickly and easily and build off of a Web Service on another office's server or if you have hoardes of legacy COM code, you'll use C#. If you have a giant UNIX server farm running JSP you'll use... That's right! Java. If you're a madman who likes to make Frankensteins in your spare time, you'll use J#. :^)

    The biggest difference isn't syntaxical. It's the mindset of the companies behind the code. No matter how many times MS wants to claim C# isn't a Java clone, the point is it's a well-done language based on lessons learned by programmers who are familiar with Java. My only fear is that C#, an excellent language in theory by anyone's measure, is going to be wrung through Microsoft's "profit maximization machine" and be made to do things that, in practice, aren't the best.

    The neat part is that people familiar with C#'s concepts will also be able to quickly learn Java! I wouldn't be too surprised to see some VB programmers turned C# developers start to think, "Hey, you know it wouldn't be that hard to run this on [Linux/OS X/etc] by implementing this idea in Java!"

    --

    It's all 0s and 1s. Or it's not.
  22. Functionality of Windows? by Merk · · Score: 3, Flamebait

    Stupid slashdot lameness filter. Shouldn't a geek site support a means of posting source code??

    Gee, you mean like being able to generate an app that causes a BSOD using a java-like syntax?

    All kidding aside, there are some cool ideas in the language. Support for enumeration is one. Currently most enum-type things in Java are done with integers, and so you have to do bounds checking whenever you get a value. The foreach operator is another nice one. It's a minor change, but it makes certain loops much quicker to write and much more readable. I also like operator overloading. It has never seemed right that in Java "+" concatenates strings, which are objects, but they're the only special object in the system. I admit that in C++ doing operator overloading properly can be hard, but it's a really convenient OO feature.

    The C# way of multiple interface implementation seems like it could be good, but will mostly just cause programmer errors.

    public interface ITeller
    {
    void Next ();
    }

    public interface IIterator
    {
    void Next ();
    }

    public class Clark : ITeller, IIterator
    {
    void ITeller.Next () {
    }
    void IIterator.Next () {
    }
    }

    To me that just looks like a bug waiting to happen. Under occasional circumstances it means you can do something you couldn't otherwise do, but this just looks dangerous to me.

    Mostly though I look at C# and say to myself: "Shouldn't a language that was designed years after Java be better than Java?". Java got rid of the preprocessor. This is a good thing, C# brings it back. That's a bad thing. (I know, conditional compilation is nice, but don't do it with a preprocessor, ick!) And what about reflection and dynamic class loading? Those are some sweet features, especially in a networked language, but in C# they're missing/gutted.

    And then there's just wierd-ass syntax pollution:

    [AuthorAttribute ("Ben Albahari")]
    class A
    {
    [Localizable(true)]
    public String Text {
    get {return text;
    }
    ...
    }
    }

    I can accept the strange getter/setter method, though I think it's dumb. It's just vb-like, with a strange and confusing mix of methods, functions and subroutines. But what's with that array-like crap? Btw, that's also how synchronized methods are declared.

    I wonder if Sun would ever agree to put some of the nice features into Java, or if the language is essentially frozen, and they're going to work on the APIs.

    Btw, the MSXML parser? It's certainly MS, and certainly not XML.

  23. Slashdotted! by hugg · · Score: 3, Informative

    For those who feel like they're downloading the page over a 110-baud modem with an acoustic coupler located in the same room as a Disaster Area concert, here are some other similar comparisons.

  24. Alternate Site For Article... by Carnage4Life · · Score: 4, Informative

    Get it here

    PS: Mirrors encouraged, so if you manage to grab it and can host it at a site with beefier bandwidth, go ahead.

  25. another mirror by Lord+Omlette · · Score: 3, Informative

    here.

    It'll be off the front page tomorrow, so all these mirrors shouldn't be needed...

    --
    [o]_O
  26. C# is what Java developers really want... by javabandit · · Score: 5, Interesting

    C# being better designed than Java is no big surprise. Why? Because Sun has done very little to further the actual language itself.

    Java really hasn't changed much since its inception. All we have are a few more libraries, a GUI framework that blows ass, and a server-side framework that we didn't really need to begin with. But we have no real additional language FEATURES.

    Like a lot of people, I've been using Java since the beginning. I look at the C# language and I see everything I want in Java. The great majority of differences between C# and Java are purely syntactical sugar -- compiler candy. AND THAT IS WHAT WE WANT.

    We've been asking for support for generics and parametric types since JDK1.1. And they still aren't in (they were removed from 1.4 at the last minute). We've been asking for A REAL CONST. We've been asking for assertions -- and finally got them.

    But all in all... most SEASONED Java developers aren't happy with the progress. Java has been plainly behind the curve when it comes to evolving new and different features. Instead, Sun poured all of their effort into their bullshit J2EE framework which is a complete shambles, IMHO.

    Its obvious. Microsoft simply went to Usenet... read a bunch of Java posts... and saw that Java was stagnant. They took advantage of it. They created a new language... based upon Java... adding everything that Java developers were complaining about. Voila! C#!

    I wonder if this would have happened if Java were open source. Probably not.

    But one thing for sure... Microsoft is an EXPERT at catching a company while it is asleep at the wheel... ripping of its product... making it better... and seizing an entire market.

    They just might be doing it again...

  27. Laundry list of corrections by coonsta · · Score: 4, Insightful

    I think this is a bit Java biased, in that it uses some very precise wording and fails to mention a lot of relevant features of C# until the appendix-like section D. And it contains some outright mistakes.

    My corrections:

    A.2: Java doesn't have an "unsafe" keyword; C# and Java have a "volatile" keyword that is strangely missing. And don't you think it's strange that he doesn't equate C#'s "extern" with Java's "native"? They're approximately the same.

    A.5: Neglects to mention here that C# has square *and* jagged arrays, it is stuck in section D.

    A.10: The phrase "both languages have an inheritance hierarchy where all exceptions are derived from a single Exception class" is a tautology, because "all exceptions" *are* exceptions because they extend Exception! Whereas if he meant to say "all objects that can be thrown are instances of types derived from a single Exception class" he would be wrong, because in Java these all derive from java.lang.Throwable.

    The sentence two sentences after that one, starting "Finally, both languages..." does not make sense.

    B.8: The last statement in this paragraph is incorrect. Isn't it possibly in Java to simply write ArrayList.class, if java.util.ArrayList has been imported? Likewise in C#, where if System.Collections has not been using'ed it is necessary to write typeof(System.Collections.ArrayList).

    C.1: This really should mention delegates here. It was inner classes v. delegates that heated up the Sun vs. J++ debate. Thus C# doesn't suffer a "lack" of inner classes, rather it suffers an ideological difference with Java, don't you think? And likewise, Java doesn't suffer a "lack" of delegates.

    C.3: The criticism that, for example, it is possible to overload "", and this makes overloading bad, and C# has overloading, hence C# is bad-- is nonsense! In C# it is illegal to overload, for example "", or "==" but not "!=".

    It also says "()" (I assume meaning cast) and "[]" can not be overloaded. This is again very precise and misleading language. They can not be overloaded, because custom conversions and indexers can be used instead!

    It also fails to mention that "&&", etc. will call "&". The blanket statement that "&&", "||", etc. "can not be overloaded" is very misleading.

    C.4: You can "fall through" in C#, with goto. Except unlike Java, in C# it is explicit (and more flexible).

    Fails to mention Java's limited range of "switch" statements, whereas e.g. C# can switch on a ulong.

    C.5: Seems to miss the distinction between *assemblies* and *modules*.

    C.6: Some of these criticisms are unfair, e.g. that Java has thread-safe collections. In C#, a reference to a synchronized wrapper can be kept and the un-thread safe reference be let go out of scope!

    Not mentioning boxing and unboxing here is a failure: one of the chief gripes with Java's collections is that it is necessary to wrap the primitive types in their class equivalents.

    C.7: Java has a labeled goto of sorts-- break and continue. Thus some of the criticisms of the weakness of languages with goto may also be applied to Java.

    C.8: Is this section intended to confuse? The fact that marking a method final in Java means that subclasses cannot contain a method with a similar signature is a *coincidence* arising from the fact that (a) final means methods can not be overridden and (b) Java does not have new/reintroduce semantics and relies instead of the name and parameters. Thus C#'s final achieves exactly the same as Java's in terms of dynamic linking and dispatch-- that a particular method can not be overridden.

    D.3: Should probably mention that .NET has an attribute for marking enumerations as able to be used in bitwise combination, whereas this is always possible (whether correct or not) in a Java pseudo-enumeration with int members. On the other hand, the "workaround" in Java makes this impossible-- you can't "or" objects.

    Well, that's my $0.02. Apart from those glaring problems, the discussion is not bad.