Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

To me it seems these are two different platforms that address similar enterprise(but not only) problems. I'm interested however in problems that Java can solve better than C#/.NET or C#/.NET can solve better than Java. Leaving aside the 'cost' factor, since that is somehow not an issue for big enterprise companies (the developers probably cost more than the licenses from Microsoft - it's just a thought) and even for small projects there are free/open-source tools for .NET so the cost can be zero for the .NET world as well. With Mono, you can port .NET to Linux and MacOS as well so the benefit that Java had(cross platform) isn't THE decision factor to use Java nowadays..

What real world problems can you think of where .NET would be a much better solution than Java, and vice-versa? I'm only interested in solutions to problems.

share|improve this question
    
@sbi: The question is about platforms, not languages. On the Java platform, Scala and Clojure support automatic resource management like C#'s using. –  missingfaktor Dec 3 '10 at 13:28
4  
Pepsi or Coke?? –  Dal Dec 3 '10 at 13:28
    
@missingfaktor: You're right. Sorry for the brainfart. I have deleted it. –  sbi Dec 3 '10 at 13:43
add comment

5 Answers

up vote 7 down vote accepted

There are some language features in C# (4/5) such as LINQ, using predicate and some functional aspects that many would argue place it ahead of Java 6 in terms of productivity/flexibility (YMMV on that). Others would argue that C# is becoming a big cesspit of every brand new idea that happens to be popular and it's getting harder to wield effectively (YMMV on that).

Some will also argue that the Java eco-system is far more flexible and that the JVM is probably the most capable and flexible runtime around (if you look at the various languages that run on the JVM adn their interoperability with Java). Again YMMV.

What it really boils down to is the quality of the developer(s) who are designing and writing the code. .NET and the Java eco-system are so close in capabilities that its usually the developer that makes a difference.

From a systems integration flexibility aspect, yes Java still has an edge there. Cross platform is still an issue - many enterprises will see using Mono as risky (again YMMV here) and there are some systems that Mono won't run on that have JVMs (Some older big IBM machines for example). Java has also been around a bit longer and has that established 'trust' in enterprises, it's not easy for .NET to gain that trust at say a mega-bank.

Meh - I conclude with no real conclusion, which I think mirrors the fact that Java and .NET are neck and neck these days.

share|improve this answer
1  
Nice answer, thank you. –  Maxtor Dec 3 '10 at 13:01
    
You're very welcome - it's a debate I have often with my .NET developer friends :) (I co-lead the London JUG, so I guess I'm Java biased) –  Martijn Verburg Dec 3 '10 at 15:21
    
Mono is still a separate platform, requiring separate testing. –  user1249 Apr 27 '11 at 6:48
add comment

For us we can run Java programs on our deployment platform and we cannot run neither .NET nor Mono.

The world is larger than just Windows+Linux+OS X.

share|improve this answer
2  
Do you mind elaborating a bit ? –  Maxtor Dec 3 '10 at 12:31
    
@Maxtor. We deploy to an IBM platform (IBM i to be precise) which does not run Windows or Unix. IBM does not provide .NET or Mono for this platform, but they do provide a Java implementation. –  user1249 Dec 3 '10 at 17:23
    
Of course they do, it's IBM. –  Maxtor Dec 3 '10 at 17:27
    
@Maxtor, do you understand now that .NET is completely unsuited for solving our problems? –  user1249 Dec 3 '10 at 17:34
    
Yes. Thanks for clarifying by the way. –  Maxtor Dec 3 '10 at 17:37
add comment

the only significant differences that I am aware of - and my information may be out of date - are:

  • MS Office automation/integration is easier in .NET
  • C# supports 'unsafe' code for direct memory manipulation; Java I believe still lacks this. You don't need this often, but when you do the difference in efficiency can be incredible
  • integration with non-VM libraries (COM/DLL/etc) seems to be easier in .NET than Java (unless JINI has vastly improved over the years)
  • Java actually works on more than the Windows platform without being six versions out of date

If you don't need any of these things, then it doesn't matter - though Java is far less expensive for the 'official' tool set ;-)

share|improve this answer
add comment

I don't think there is any class of problem domain that begs for one or the other. Some platforms can't run .NET, such as certain smart phones and so J2ME has some more portability.

In the enterprise space, I usually see this decision based on the experience of the team, or if its a new group/project then the experience of its initial managers.

In my team, we have a lot of both .NET and J2EE. This is mostly for the reason that there are different strengths in terms of the existing open source projects we can use; and we have vendor runtime platforms that require one or the other. We do all our UI work in .NET; most of our integration and search platform is hosted on Java. Our middleware is a mixed bag. I'm sure this horrifies some people but it really gives us a lot of flexibility and saves us a lot of time in the end because we can leverage the best products in their problem domain, not just on our platform.

share|improve this answer
add comment

If you're concerned with smart phone programming, Android runs Java, not C#. Windows phones will run Microsoft's dev tools, but Android already has huge market share and it remains to be seen whether or not Windows 7 phones can grab a significant piece of the pie for themselves. With Microsoft behind them you can never count them out because of their incredible resources. However, until there is even some degree of parity between those two phone platforms, if you want to do Android phone programming you have to choose Java. Since Objective-C/Cocoa development was not part of the question I left iPhone development out of my post.

For completeness I should point out the existence of the MonoDroid project that allows you to use .NET tools for Android applications:

As a C# developer, would you learn Java to develop for Android or use MonoDroid instead?

Perhaps that could be considered counter point to my assertion. Note that MonoDroid is not free as opposed to Eclipse/Java/Android SDK, and don't forget the cost of VS2010 and related tools too.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.