Become a fan of Slashdot on Facebook

 



Forgot your password?
typodupeerror
×
Programming Java Microsoft Oracle

Java API and Microsoft's .NET API: a Comparison 319

Nerval's Lobster writes "Previously, developer Jeff Cogswell focused on the respective performances of C# and Java. Now he's looking at yet another aspect of the languages: the runtime libraries—what exactly the libraries are, how they are called, and what features the languages provide for calling into them. Examining the official Java API (now owned by Oracle) and the official .NET API owned by Microsoft, he finds both pretty complete and pretty much a 'tie' with regard to ease-of-use and functionality, especially since Java version 7 release 6 allows for automatic resource management. Read on and see if you agree."
This discussion has been archived. No new comments can be posted.

Java API and Microsoft's .NET API: a Comparison

Comments Filter:
  • by paysonwelch ( 2505012 ) on Wednesday June 19, 2013 @05:58PM (#44054639) Homepage
    However, I mostly code in C# .NET and I dabble in Java in my spare time to model financial markets. What I have found is that C# has some powerful features that other languages do not have. This allows the .NET framework to be a little more robust than Java. Also my opinion is that C# and .NET creates a more syntactically elegant and coder friendly experience whereas Java is good, but not as good as .NET. In closing, C# .NET > Java. Please address .NET hate-responses to /dev/null
    • by Xest ( 935314 ) on Wednesday June 19, 2013 @06:03PM (#44054695)

      Microsoft has had the benefit of being the single controller of the .NET framework whilst Java has been victim of design by committee a lot of the time. This is why the .NET framework has managed to stay tidier and more focussed, but as I said in my other post what does it matter, because who the fuck sticks to just the core framework anyway when there are things like Spring out there?

      • Anybody who isn't a massive corporation is better off sticking w the core framework for maintainability & scope purposes.

      • by iluvcapra ( 782887 ) on Wednesday June 19, 2013 @06:38PM (#44055043)
        Microsoft also had the benefit of Java going first and making all the mistakes, and then Microsoft got lucky when Java lost its first-mover advantage chasing down several blind alleyways -- "Applets", Sun's mismanagement, a bureaucratic open source strategy.
        • by devent ( 1627873 )

          Applets are still freaking good.
          Look at for example: http://jchart2d.sourceforge.net/applet.shtml [sourceforge.net]
          I can get a full demo of the application in my web browser, how cool is that. IMHO the browser developers sunk Java Applets, because of their concentration to Flash and JavaScript. Java Applets are still way better then what you can do with JavaScript. For example, 3D with OpenGL, and it don't take 50% of my CPU like with JavaScript.

          Open source is one of the strongest points of Java. There are now 500,000 open s

      • by Michalson ( 638911 ) on Wednesday June 19, 2013 @08:19PM (#44055895)
        Microsoft has also had the benefit of Anders Hejlsberg being the lead architect, one of the best minds in the industry. There are maybe a handful of people in the industry today that can stand at the same level as him, and none currently alive that can stand taller. Hiring him away was a major boon to Microsoft and a crushing blow to Borland.
        • by benjymouse ( 756774 ) on Wednesday June 19, 2013 @08:31PM (#44055985)

          Microsoft has also had the benefit of Anders Hejlsberg being the lead architect, one of the best minds in the industry. There are maybe a handful of people in the industry today that can stand at the same level as him, and none currently alive that can stand taller. Hiring him away was a major boon to Microsoft and a crushing blow to Borland.

          As much as I love to code in C#, I think that Martin Odersky is at least as smart and knowledgeable as Anders Hejlsberg. I've seen them debate each other and IMHO Martin came out looking somewhat better. And Scala is no small feat.

      • "who the fuck sticks to just the core framework anyway "

        Someone who needs a solid and consistant application platform?

    • by OhSoLaMeow ( 2536022 ) on Wednesday June 19, 2013 @06:06PM (#44054719)

      In closing, C# .NET > Java. Please address .NET hate-responses to /dev/null

      Your windows environment has /dev/null?

      How cool is that?

      • by Mitchell314 ( 1576581 ) on Wednesday June 19, 2013 @06:11PM (#44054761)
        Yes. It's c:\.
      • Yes, although we call it NUL: or \Device\Null

      • If your going to post a ".NET hate response" I imagine your system has a /dev/null/
      • As a matter of fact, it does. I mean, strictly speaking it's at \\.\C:\Windows\SUA\dev\null, but according to bash:
        $ ls -l /dev/null
        crw-rw-rw- 1 +SYSTEM 0 48, 0 Dec 5 2012 /dev/null
        $ uname -a
        Interix Jayne 6.2 10.0.7063.0 authenticamd AMD64_Family_21_Model_2_Stepping_0
        $ echo $SUA_ROOT
        /dev/fs/C/Windows/SUA/

    • by AmiMoJo ( 196126 ) * on Wednesday June 19, 2013 @06:19PM (#44054849) Homepage Journal

      This is the wrong question. What matters is the quality of the apps that are written in either language. In that respect C# is way ahead on the desktop, but in other areas Java is king.

    • by paulpach ( 798828 ) on Wednesday June 19, 2013 @07:01PM (#44055289)

      I am both a professional java and C# developer. Each one has their advantages:

      On the C# camp:
      * delegates and events
      * functional constructs
      * automatic variable types
      * LINQ
      * Value types (efficiently allocate thousands of value objects in an array, you need some really nasty workarounds in java)
      * Generics that keep their types at runtime

      On the java camp:
      * Spring (There is Spring.Net, but lets be honest: it does not compare)
      * Collections library (much more complete and better thought out than C#'s)
      * Maven
      * J2EE
      * A million other libraries freely available, that do _anything_ you want.
      * Portable to more platforms (Mono sometimes leaves something to be desired)

      So in my humble opinion, C# is much more complete as a language, but java has much better libraries and community. So which one would I pick? well, it depends on the project, the platform, and the amount of code I can reuse from open source libraries.

    • I don't use C#, however last I looked all of its features were borrowed from other preexisting languages, same as Java. Is there something new and Microsoft for once in its life has done something novel?

      • by benjymouse ( 756774 ) on Wednesday June 19, 2013 @07:41PM (#44055631)

        I don't use C#, however last I looked all of its features were borrowed from other preexisting languages, same as Java. Is there something new and Microsoft for once in its life has done something novel?

        LINQ is a pretty big deal. I don't know of any language that has something similar. LINQ itself is comprised of a number of language constructs such as expression trees, extension methods, type inference, anonymous types.

        Async/await is huge! Right there, MS looks to leapfrog other platforms by allowing developers to create robust, asynchronous programs that doesn't need to spin up threads (or use threadpools) to achieve perfectly composable asynchronous methods.

        Dynamic support (statically typed to be of dynamic type) allows the best from dynamic languages to be used from within C#, even interop'ing with dynamic languages and e.g. use an object created in Ruby as a first-class object in C# (or vice versa).

        • To be fair async still uses threadpools and you have to be careful how you use it so you don't starve it but yeah Linq, async and dynamic are all big deals. I'd also add how maintained it is. Thinking of the recent java volunerablity they new about it for something like 8 months I think before patching it. As bad as MSs rep is I don't think they would do that. Their ecosystem revolves on tools and platforms to keep the windows and Office (and SQL and sharepoint) the platform of choice for IT/devs. What does

          • To be fair async still uses threadpools and you have to be careful how you use it so you don't starve it

            That is incorrect. async does not use thread pools. Async by itself says nothing about threads, and - more importantly - it will NEVER spin up a thread or take a thread from a threadpool by itself.

            It is true that you can start parallel execution yourself and then use async/await to synchronize, but async/await is really a more fundamental concept compared to threads.

    • Please address .NET hate-responses to /dev/null

      You would have more luck with that if you'd actually had some substance in your post. You basically said, "I like .NET better than Java," but didn't explain why.

      Specifically I'd like to hear why you think the .NET framework is more robust than Java. Of all the reasons I could think of for supporting .NET over Java, that is not one of them. What makes you say it's robust?

    • by Chrisq ( 894406 )

      However, I mostly code in C# .NET and I dabble in Java in my spare time to model financial markets. What I have found is that C# has some powerful features that other languages do not have. This allows the .NET framework to be a little more robust than Java. Also my opinion is that C# and .NET creates a more syntactically elegant and coder friendly experience whereas Java is good, but not as good as .NET. In closing, C# .NET > Java. Please address .NET hate-responses to /dev/null

      I'm not saying its the case here, but often the best framework is the one you know best. Of course that is true for you personally, but its sometimes hard to distinguish "I'm not sure how to do it with that API" to "that API is not as clear as the one I know well".

  • As much as I like Java, there's a few obvious features that it's somehow still missing:

    • Signals/slots
    • Async methods
    • Properties

    C# has all of these, of course.

  • by medv4380 ( 1604309 ) on Wednesday June 19, 2013 @06:08PM (#44054739)
    C# was the direct result of MS being blocked from using Java, and was their J# product re-branded into .net. The core is nearly identical with the exception that C# has access to things like DirectX, and a few other nice to have APIs from MS
    • by mwvdlee ( 775178 )

      How exactly was MS blocked from using Java?
      Or do you mean their attempt at embrace, extend and extinguish known as J++?

      FWIW, I like both languages, but they have entirely different markets. Windows-only? C#. Multi-platform? Java (Mono is no full C# .NET substitute).

      • by naoursla ( 99850 )

        > How exactly was MS blocked from using Java?

        By court order, IIRC.

        • by bmo ( 77928 ) on Wednesday June 19, 2013 @06:49PM (#44055167)

          No, they weren't blocked from using Java.

          They were blocked from creating their own non-standard Java.

          Because Sun owned the trademark and the standard. Now owned by Evil Larry.

          You can create your own language and API, but you can't call it Java if it doesn't meet the standard. How difficult is this to understand?

          Poor persecuted Microsoft.

          --
          BMO

    • by bmo ( 77928 ) on Wednesday June 19, 2013 @06:33PM (#44054989)

      C# was the direct result of MS being blocked from using Java,

      No, no it wasn't.

      It was that Sun owned the standard and told Microsoft to quit violating the standard or call it something else.

      Sun sued and won in court, because they were right.

      If the situation was reversed, I'm sure you'd be saying Microsoft was in the right for defending C#.

      Microsoft was always free to use Java and write their own version, as long as it conformed to the standard. But Microsoft being Microsoft, "standards are for pussies."

      --
      BMO

      • MS's extensions were to make it easier to access system code without having to go through the typical hurdles you do in Java (JNI is a little bitch). That said it was a violation of the Java specification. When MS created C#, as a language there were specific ties to support "unsafe" execution (direct access to pointers, and lower-level system structures), as well as C-style library interfaces via easy [DllImport] declarations and via direct PInvoke statements. IMHO this is the single biggest advantage t
  • by thewils ( 463314 ) on Wednesday June 19, 2013 @06:10PM (#44054749) Journal

    C# does not appear to have 40 Critical bug fixes every quarter like Java does either. The latest Java update has caused a _lot_ of business systems to crash.

    • Re: (Score:2, Informative)

      by phantomfive ( 622387 )

      C# does not appear to have 40 Critical bug fixes every quarter like Java does either.

      Sure they do [lmgtfy.com]. The flaws aren't in the language (with Java or Silverlight), after all, if you're running a program on your local machine in either of those languages, they're designed to give you access to the filesystem, etc. the flaw in the idea of trying to run foreign code on a local sandbox. Good luck.

      • C# does not appear to have 40 Critical bug fixes every quarter like Java does either.

        Sure they do [lmgtfy.com]

        You need to do better than that. Try secunia:

        Silverlight 3: 2 vulnerabilities
        Silverlight 4: 7 vulnerabilities
        Silverlight 5: 4 vulnerabilities.

        Hardly the swiss cheese that is Java applets.

  • I hate them both (Score:5, Interesting)

    by Gothmolly ( 148874 ) on Wednesday June 19, 2013 @06:12PM (#44054771)

    As they are the harbingers of the new age, post dotcom world, where overspecced hardware fixes everything, where there are legions of entitled douchebag "developers" who took a certification course, and of apps which can't run in less than 8GB of memory (our resident BOFH hung up on our developers when they asked for a 64GB VM because they kept getting OOM errors in Java).

    In short, both languages rode the crest of the cultural revolution where it is now OK to suck, to offshore code development with no expectation of quality coming back, of "agile" methods where your next version is always going to be the stable one. I'm not exactly saying that these languages CAUSED any of this, but there is at least a temporal correlation.

    Yes, I am a Unix guy, and yes, I have grey hair.

    • by Elfboy ( 144703 )

      If I only had mod points....

      Also a grey hair here however C# has been paying the bills lately.

    • Ok, I'll bite . . . so is there anything that you do like . . . ?

      • Ok, I'll bite . . . so is there anything that you do like . . . ?

        I'm guessing based on his comment, probably C, maybe even some assembler.

    • When you're trying to put food on the table in this economy, working as an inexperienced developer isn't what most would call being a douchebag.
    • Re: (Score:3, Funny)

      by hsmith ( 818216 )
      Nice rant, grandpa. Yeah, we should all be coding in ASM, because it produces such better products! Eyeroll.
      • by narcc ( 412956 )

        Yeah, because ASM is the only alternative. Eyeroll.

        "Grandpa" is right. We've traded an awful lot of bloat for ... what, exactly? Vague promises of improved developer productivity? The outright lie of simplicity?

        He may not be willing to blame the languages outright, but I'd back him up if he did.

    • ... management is, at least most of the time.

      Let me say that it is easy to create GREAT systems in Java (and I assume in C#/.NET). However, in enterprise world, that seldom happens. That is not because of languages, but because of several management related issues:

      1. Technical excelence is rarely seen as a goal, implementing features is.
      2. Technical fixes do not drive development, satisfying business requirements does.
      3. Things are rarely if ever refactored, consolidated or tidied up, as business doe
  • by benjymouse ( 756774 ) on Wednesday June 19, 2013 @06:13PM (#44054775)

    Async methods (huge!)
    Generator methods
    Partial classes/methods
    Reified generics
    LINQ (as in LINQ to objects, LINQ to Entities, LINQ to XML - all part of the core framework)
    Dynamic typing and -interop
    Value types
    Operator overloading
    Implicit/explicit type conversions

    • by Shados ( 741919 )

      Don't forget properties as a first class concept.

    • ...
      LINQ (as in LINQ to objects, LINQ to Entities, LINQ to XML - all part of the core framework)
      ...

      This is my biggest gripe with TFA: He says "the data access APIs are complete, and you can effectively accomplish the same thing". Sure, you could, with only a slightly smaller amount of code than accomplishing the code in C. The ability to both filter data and synthesize new records through combination easily, even as a feature of the standard library, is powerful. That it is a syntactic feature is amazing on the order of Perl making regular expression literals a thing. Java has absolutely no construct th

    • You can add lambda expressions as well, although, that's coming in JRE 7, no, 8 maybe.

  • by sttlmark ( 737942 ) on Wednesday June 19, 2013 @06:19PM (#44054855)

    I use both, and I find that .NET really shines when you're in unfamiliar territory and working with a part of the framework that you don't touch every day. Features are more easily discovered and idioms tend to be more consistently applied in .NET, whereas it feels like Java suffers from implementers applying the pattern du jour, forcing you to wade through more docs.

    I attribute much of .NET's success in this regard to the absolutely awesome book "Framework Design Guidelines: Conventions, Idioms, and Patterns for Reusable .NET Libraries," which includes a lot of direct insights from the designers of the framework. Microsoft has been really good about sticking to those guidelines, and it shows.

    http://www.amazon.com/Framework-Design-Guidelines-Conventions-Libraries/dp/0321545613 [amazon.com] ...or maybe I just understand the .NET Framework better because I read that book. I'm not aware of a Java corollary that would give me the same insights, though.

    • Comment removed based on user account deletion
      • by Shados ( 741919 )

        You have the same thing on C#. What docs are you looking at that doesn't have plain hierarchies with links to every class and full docs with examples? I use it every day.

        I'll agree with the "drama" if you're using winforms and vb.net though. Long time .NET users have been burnt a few too many times by those environments, so they get emotional about them.

  • Both have big APIs.

  • Comment removed based on user account deletion
  • I'm wondering how C# async methods got skipped. Because there's nothing similar in Java?

    Async/await is huge. It makes composing async methods as terse as regular synchronous code. Unlike with the library defined task/future models, async/await adds a composable model which lets you write async methods that can loop, branch, try-catch etc. while staying perfectly async.

  • I was hoping to provide some insights, but the article is just riddled with misunderstandings. I stopped reading after this line:

    "Generally speaking, the API makes use of properties in the case where you supply a class or object; but the classes in the API typically donâ(TM)t make use of properties."

    No, not at all. Properties are used pretty much everywhere in the API. Examples abound with get only properties (ahem Length?).

    Methinks Mr. Cogswell is in way over his head. Language design is not an easy s

"If it ain't broke, don't fix it." - Bert Lantz

Working...